blob: 2ac8422b88137c2ca9232e22778edcdd70005530 [file] [log] [blame]
Scott Bakerc41914d2017-06-26 14:00:52 -07001lab="External"
2for service in ["HyperCache", "RequestRouter"]:
3 for node in ListAll("Node"):
4 node_id = node["node_id"]
5 for interface_id in node["interface_ids"]:
6 iface=Read("Interface", interface_id)
7 if iface["is_primary"] and len(iface["ip_address_ids"])==1:
8 ip_id = iface["ip_address_ids"][0]
9 if ListAll("LogicalInterface", {"node_id": node_id, "ip_address_ids": [ip_id], "label": lab, "service": service}):
10 print "External label exists for node", node_id, "ip", ip_id, "service", service
11 else:
12 print "Adding external label for node", node_id, "ip", ip_id, "service", service
13 li = Create("LogicalInterface", {"node_id": node_id, "label": lab, "service": service})
14 Bind("LogicalInterface", li, "IpAddress", ip_id)