コード例 #1
0
ファイル: test_nvplib.py プロジェクト: StackOps/quantum
 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')
コード例 #2
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))
コード例 #3
0
ファイル: test_nvplib.py プロジェクト: StackOps/quantum
 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))
コード例 #4
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')