Exemplo n.º 1
0
 def test_plug_l2_gw_port_attachment(self):
     tenant_id = 'pippo'
     node_uuid = _uuid()
     lswitch = nvplib.create_lswitch(self.fake_cluster, tenant_id,
                                     'fake-switch')
     gw_id = self._create_gw_service(node_uuid, 'fake-gw')['uuid']
     lport = nvplib.create_lport(self.fake_cluster,
                                 lswitch['uuid'],
                                 tenant_id,
                                 _uuid(),
                                 'fake-gw-port',
                                 gw_id,
                                 True)
     json.loads(nvplib.plug_l2_gw_service(self.fake_cluster,
                                          lswitch['uuid'],
                                          lport['uuid'],
                                          gw_id))
     uri = nvplib._build_uri_path(nvplib.LSWITCHPORT_RESOURCE,
                                  lport['uuid'],
                                  lswitch['uuid'],
                                  is_attachment=True)
     resp_obj = json.loads(
         nvplib.do_single_request("GET", uri,
                                  cluster=self.fake_cluster))
     self.assertIn('LogicalPortAttachment', resp_obj)
     self.assertEqual(resp_obj['LogicalPortAttachment']['type'],
                      'L2GatewayAttachment')
Exemplo n.º 2
0
    def tearDown(self):
        self._delete_tz(self.BRIDGE_TZ_UUID)

        for (net_id, p) in self.ports:
            self.quantum.unplug_interface("quantum-test-tenant", net_id, p)
            self.quantum.delete_port("quantum-test-tenant", net_id, p)
        for n in self.networks:
            self.quantum.delete_network("quantum-test-tenant", n)
        for t in self.transport_nodes:
            nvplib.do_single_request("DELETE", "/ws.v1/transport-node/%s" % t,
                                     controller=self.quantum.controller)
        for c in self.cis_uuids:
            nvplib.do_single_request(
                "DELETE",
                "/ws.v1/cluster-interconnect-service/%s" % c,
                controller=self.quantum.controller)
Exemplo n.º 3
0
    def tearDown(self):
        self._delete_tz(self.BRIDGE_TZ_UUID)

        for (net_id, p) in self.ports:
            self.quantum.unplug_interface("quantum-test-tenant", net_id, p)
            self.quantum.delete_port("quantum-test-tenant", net_id, p)
        for n in self.networks:
            self.quantum.delete_network("quantum-test-tenant", n)
        for t in self.transport_nodes:
            nvplib.do_single_request("DELETE", "/ws.v1/transport-node/%s" % t,
                                     controller=self.quantum.controller)
        for c in self.cis_uuids:
            nvplib.do_single_request(
                "DELETE",
                "/ws.v1/cluster-interconnect-service/%s" % c,
                controller=self.quantum.controller)
Exemplo n.º 4
0
 def _test_create_lrouter_dnat_rule(self, func):
     tenant_id = 'pippo'
     lrouter = nvplib.create_lrouter(self.fake_cluster, tenant_id,
                                     'fake_router', '192.168.0.1')
     nat_rule = func(
         self.fake_cluster,
         lrouter['uuid'],
         '10.0.0.99',
         match_criteria={'destination_ip_addresses': '192.168.0.5'})
     uri = nvplib._build_uri_path(nvplib.LROUTERNAT_RESOURCE,
                                  nat_rule['uuid'], lrouter['uuid'])
     return json.loads(
         nvplib.do_single_request("GET", uri, cluster=self.fake_cluster))
Exemplo n.º 5
0
 def _test_create_lrouter_dnat_rule(self, func):
     tenant_id = 'pippo'
     lrouter = nvplib.create_lrouter(self.fake_cluster,
                                     tenant_id,
                                     'fake_router',
                                     '192.168.0.1')
     nat_rule = func(self.fake_cluster, lrouter['uuid'], '10.0.0.99',
                     match_criteria={'destination_ip_addresses':
                                     '192.168.0.5'})
     uri = nvplib._build_uri_path(nvplib.LROUTERNAT_RESOURCE,
                                  nat_rule['uuid'],
                                  lrouter['uuid'])
     return json.loads(nvplib.do_single_request("GET", uri,
                                                cluster=self.fake_cluster))
Exemplo n.º 6
0
 def test_plug_l2_gw_port_attachment(self):
     tenant_id = 'pippo'
     node_uuid = _uuid()
     lswitch = nvplib.create_lswitch(self.fake_cluster, tenant_id,
                                     'fake-switch')
     gw_id = self._create_gw_service(node_uuid, 'fake-gw')['uuid']
     lport = nvplib.create_lport(self.fake_cluster, lswitch['uuid'],
                                 tenant_id, _uuid(), 'fake-gw-port', gw_id,
                                 True)
     json.loads(
         nvplib.plug_l2_gw_service(self.fake_cluster, lswitch['uuid'],
                                   lport['uuid'], gw_id))
     uri = nvplib._build_uri_path(nvplib.LSWITCHPORT_RESOURCE,
                                  lport['uuid'],
                                  lswitch['uuid'],
                                  is_attachment=True)
     resp_obj = json.loads(
         nvplib.do_single_request("GET", uri, cluster=self.fake_cluster))
     self.assertIn('LogicalPortAttachment', resp_obj)
     self.assertEqual(resp_obj['LogicalPortAttachment']['type'],
                      'L2GatewayAttachment')