diff options
Diffstat (limited to 'utils/openstack_utils.py')
-rw-r--r-- | utils/openstack_utils.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py index b93d3818..b463bf4a 100644 --- a/utils/openstack_utils.py +++ b/utils/openstack_utils.py @@ -183,7 +183,8 @@ def get_hypervisors(nova_client): nodes = [] hypervisors = nova_client.hypervisors.list() for hypervisor in hypervisors: - nodes.append(hypervisor.hypervisor_hostname) + if hypervisor.state == "up": + nodes.append(hypervisor.hypervisor_hostname) return nodes except Exception, e: print "Error [get_hypervisors(nova_client)]:", e @@ -614,9 +615,27 @@ def create_network_full(logger, return network_dic +def create_bgpvpn(neutron_client, **kwargs): + # route_distinguishers + # route_targets + json_body = {"bgpvpn": kwargs} + return neutron_client.create_bgpvpn(json_body) + + +def create_network_association(neutron_client, bgpvpn_id, neutron_network_id): + json_body = {"network_association": {"network_id": neutron_network_id}} + return neutron_client.create_network_association(bgpvpn_id, json_body) + + +def update_bgpvpn(neutron_client, bgpvpn_id, **kwargs): + json_body = {"bgpvpn": kwargs} + return neutron_client.update_bgpvpn(bgpvpn_id, json_body) + # ********************************************* # SEC GROUPS # ********************************************* + + def get_security_groups(neutron_client): try: security_groups = neutron_client.list_security_groups()[ |