Beispiel #1
0
 def create_bulk_network(self, count, names):
     uri = '%s/networks' % (self.uri_prefix)
     post_body = Element("networks")
     for i in range(count):
             p1 = Element("network")
             p2 = Element("name", names[i])
             p1.append(p2)
             post_body.append(p1)
     resp, body = self.post(uri, str(Document(post_body)))
     networks = parse_array(etree.fromstring(body))
     networks = {"networks": networks}
     return resp, networks
Beispiel #2
0
 def create_bulk_port(self, port_list):
     uri = '%s/ports' % (self.uri_prefix)
     post_body = Element("ports")
     for i in range(len(port_list)):
         v = port_list[i]
         p1 = Element("port")
         for k, kv in v.iteritems():
             p2 = Element(k, kv)
             p1.append(p2)
         post_body.append(p1)
     resp, body = self.post(uri, str(Document(post_body)))
     ports = parse_array(etree.fromstring(body))
     ports = {"ports": ports}
     return resp, ports
Beispiel #3
0
 def deserialize_list(self, body):
     return common.parse_array(etree.fromstring(body), self.PLURALS)
Beispiel #4
0
 def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
     uri = '%s/agents/%s/dhcp-networks' % (self.uri_prefix, agent_id)
     resp, body = self.get(uri)
     networks = common.parse_array(etree.fromstring(body))
     body = {'networks': networks}
     return resp, body
Beispiel #5
0
 def list_dhcp_agent_hosting_network(self, network_id):
     uri = '%s/networks/%s/dhcp-agents' % (self.uri_prefix, network_id)
     resp, body = self.get(uri)
     agents = common.parse_array(etree.fromstring(body))
     body = {'agents': agents}
     return resp, body
Beispiel #6
0
 def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
     uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
     resp, body = self.get(uri)
     pools = common.parse_array(etree.fromstring(body))
     body = {'pools': pools}
     return resp, body
Beispiel #7
0
 def list_router_interfaces(self, uuid):
     uri = '%s/ports?device_id=%s' % (self.uri_prefix, uuid)
     resp, body = self.get(uri)
     ports = common.parse_array(etree.fromstring(body), self.PLURALS)
     ports = {"ports": ports}
     return resp, ports
Beispiel #8
0
 def list_l3_agents_hosting_router(self, router_id):
     uri = '%s/routers/%s/l3-agents' % (self.uri_prefix, router_id)
     resp, body = self.get(uri)
     agents = common.parse_array(etree.fromstring(body))
     body = {'agents': agents}
     return resp, body
Beispiel #9
0
 def list_routers_on_l3_agent(self, agent_id):
     uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
     resp, body = self.get(uri)
     routers = common.parse_array(etree.fromstring(body))
     body = {'routers': routers}
     return resp, body