Scott Baker | c41914d | 2017-06-26 14:00:52 -0700 | [diff] [blame^] | 1 | lab="External" |
| 2 | for 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) |