コード例 #1
0
class NuageExtraDHCPOptionsOSManagedL2Test(NuageExtraDHCPOptionsBaseL2):

    # Openstack Managed Layer 2 networks

    # def __init__(self, *args, **kwargs):
    #     super(NuageExtraDHCPOptionsOSManagedL2Test, self).__init__(
    #         *args, **kwargs)
    #     self.nuage_network_type = NUAGE_NETWORK_TYPE['OS_Managed_L2']
    #     self.vsd_parent_type = constants.L2_DOMAIN
    #
    # def test_nuage_l2_port_with_dhcp_opts_001_netmask(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_001_netmask()
    #
    # def test_nuage_l2_port_with_dhcp_opts_002_time_offset(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_002_time_offset()
    #
    # def test_nuage_l2_port_with_dhcp_opts_003_routers(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_003_routers()
    #
    # def test_nuage_l2_port_with_dhcp_opts_004_time_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_004_time_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_006_dns_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_006_dns_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_007_log_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_007_log_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_009_lpr_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_009_lpr_server()

    def test_nuage_l2_port_with_dhcp_opts_012_hostname(self):
        self._check_nuage_crud_port_with_dhcp_opts_012_hostname()

    # def test_nuage_l2_port_with_dhcp_opts_013_boot_file_size(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_013_boot_file_size()
    #
    # def test_nuage_l2_port_with_dhcp_opts_015_domain_name(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_015_domain_name()
    #
    # def test_nuage_l2_port_with_dhcp_opts_016_swap_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_016_swap_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_017_root_path(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_017_root_path()
    #
    # def test_nuage_l2_port_with_dhcp_opts_018_extension_path(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_018_extension_path()
    #
    # def test_nuage_l2_port_with_dhcp_opts_019_ip_forward_enable(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_019_ip_forward_enable()
    #
    # def test_nuage_l2_port_with_dhcp_opts_020_non_local_src_routing(
    #         self):
    #     self.\
    #         _check_nuage_crud_port_with_dhcp_opts_020_non_local_src_routing(
    #         )
    #
    # def test_nuage_l2_port_with_dhcp_opts_021_policy_filter(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_021_policy_filter()
    #
    # def test_nuage_l2_port_with_dhcp_opts_022_max_dgram_reassembly(
    #         self):
    #     self.\
    #     _check_nuage_crud_port_with_dhcp_opts_022_max_datagram_reassembly()
    #
    # def test_nuage_l2_port_with_dhcp_opts_023_default_ttl(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_023_default_ttl()
    #
    # def test_nuage_l2_port_with_dhcp_opts_026_mtu(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_026_mtu()
    #
    # def test_nuage_l2_port_with_dhcp_opts_027_all_subnets_local(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_027_all_subnets_local()
    #
    # def test_nuage_l2_port_with_dhcp_opts_028_broadcast(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_028_broadcast()
    #
    # def test_nuage_l2_port_with_dhcp_opts_031_router_discovery(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_031_router_discovery()
    #
    # def test_nuage_l2_port_with_dhcp_opts_032_rtr_solicitation(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_032_router_solicitation()
    #
    # def test_nuage_l2_port_with_dhcp_opts_033_static_route(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_033_static_route()
    #
    # def test_nuage_l2_port_with_dhcp_opts_034_trailer_encapsulation(
    #         self):
    #     self.\
    #     _check_nuage_crud_port_with_dhcp_opts_034_trailer_encapsulation()
    #
    # def test_nuage_l2_port_with_dhcp_opts_035_arp_timeout(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_035_arp_timeout()
    #
    # def test_nuage_l2_port_with_dhcp_opts_036_ethernet_encap(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_036_ethernet_encap()
    #
    # def test_nuage_l2_port_with_dhcp_opts_037_tcp_ttl(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_037_tcp_ttl()
    #
    # def test_nuage_l2_port_with_dhcp_opts_038_tcp_keepalive(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_038_tcp_keepalive()
    #
    # def test_nuage_l2_port_with_dhcp_opts_040_nis_domain(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_040_nis_domain()
    #
    # def test_nuage_l2_port_with_dhcp_opts_041_nis_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_041_nis_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_042_ntp_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_042_ntp_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_044_netbios_ns(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_044_netbios_ns()
    #
    # def test_nuage_l2_port_with_dhcp_opts_045_netbios_dd(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_045_netbios_dd()
    #
    # def test_nuage_l2_port_with_dhcp_opts_046_netbios_nodetype(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_046_netbios_nodetype()
    #
    # def test_nuage_l2_port_with_dhcp_opts_047_netbios_scope(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_047_netbios_scope()
    #
    # def test_nuage_l2_port_with_dhcp_opts_048_x_windows_fs(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_048_x_windows_fs()
    #
    # def test_nuage_l2_port_with_dhcp_opts_049_x_windows_dm(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_049_x_windows_dm()
    #
    # def test_nuage_l2_port_with_dhcp_opts_050_requested_address(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_050_requested_address()
    #
    # def test_nuage_l2_port_with_dhcp_opts_060_vendor_class(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_060_vendor_class()
    #
    # def test_nuage_l2_port_with_dhcp_opts_064_nisplus_domain(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_064_nisplus_domain()
    #
    # def test_nuage_l2_port_with_dhcp_opts_065_nisplus_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_065_nisplus_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_066_tftp_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_066_tftp_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_067_bootfile_name(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_067_bootfile_name()
    #
    # def test_nuage_l2_port_with_dhcp_opts_068_mobile_ip_home(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_068_mobile_ip_home()
    #
    # def test_nuage_l2_port_with_dhcp_opts_069_smtp_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_069_smtp_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_070_pop3_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_070_pop3_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_071_nntp_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_071_nntp_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_074_irc_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_074_irc_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_077_user_class(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_077_user_class()
    #
    # def test_nuage_l2_port_with_dhcp_opts_093_client_arch(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_093_client_arch()
    #
    # def test_nuage_l2_port_with_dhcp_opts_094_client_itf_id(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_094_client_interface_id()
    #
    # def test_nuage_l2_port_with_dhcp_opts_097_client_machine_id(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_097_client_machine_id()
    #
    # def test_nuage_l2_port_with_dhcp_opts_119_domain_search(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_119_domain_search()
    #
    # def test_nuage_l2_port_with_dhcp_opts_120_sip_server(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_120_sip_server()
    #
    # def test_nuage_l2_port_with_dhcp_opts_121_classless_static_route(
    #         self):
    #     self.\
    #     _check_nuage_crud_port_with_dhcp_opts_121_classless_static_route()
    #
    # def test_nuage_l2_port_with_dhcp_opts_125_vendor_id_encap(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_125_vendor_id_encap()
    #
    # def test_nuage_l2_port_with_dhcp_opts_255_server_ip_address(self):
    #     self._check_nuage_crud_port_with_dhcp_opts_255_server_ip_address()
    #
    # def test_nuage_l2_port_with_16_extra_dhcp_options(self):
    #     self._check_nuage_crud_port_with_16_extra_dhcp_options()

    @decorators.attr(type='smoke')
    @testtools.skipIf(Topology.before_openstack('queens'),
                      'Unsupported pre-queens')
    def test_nuage_l2_port_with_numerical_opt_name(self):
        self._check_nuage_crud_port_with_numerical_opt_name()

    @decorators.attr(type='smoke')
    @testtools.skipIf(Topology.before_openstack('queens'),
                      'Unsupported pre-queens')
    def test_nuage_l2_delete_port_extra_dhcp_opt(self):
        self._check_nuage_delete_port_extra_dhcp_opt()

    @decorators.attr(type='smoke')
    def test_nuage_l2_crud_dhcpv6_dns_server_opt(self):
        self._check_nuage_crud_port_with_dhcpv6_dns_server_opt()

    @decorators.attr(type='smoke')
    def test_nuage_l2_crud_dhcpv6_domain_search_opt(self):
        self._check_nuage_crud_port_with_dhcpv6_domain_search_opt()

    @decorators.attr(type='smoke')
    def test_nuage_l2_crud_multiple_dhcpv6_opts(self):
        self._check_nuage_crud_port_with_multiple_dhcpv6_opts()
コード例 #2
0
class VSDPublicResourcesML2Test(
        base_vsd_public_resources.BaseVSDPublicResources):

    os_shared_network = False

    if Topology.before_openstack('Newton'):
        failure_type = exceptions.ServerFault
        dhcp_port = False
    else:
        failure_type = exceptions.BadRequest
        dhcp_port = True

    @classmethod
    def skip_checks(cls):
        super(VSDPublicResourcesML2Test, cls).skip_checks()
        if not Topology.is_ml2:
            raise cls.skipException('Skipping ml2 tests with '
                                    'nuage-core plugin')

    @nuage_test.skip_because(bug='OPENSTACK-2548')
    def test_vsd_l2_shared_unmgd_l2_unmgd_without_gw_ip(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L2-Shared-domain without IPAM (i.e. UnManaged)
        # and these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedunmgd_lnkd_to_vsdl2domunmgd()

        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,

            # When I create an OS subnet with
            #   enable_dhcp == False
            #   a valid CIDR
            #   nuagenet == UUID of VSD-L2-domain
            #   no IP
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,
            cidr=VALID_CIDR,
            gateway_ip=None,

            # Then the OS subnet has
            #   an OS allocation pool covering the full CIDR range
            #   gateway_ip equal to None
            expected_gateway_ip=None,
            #   and has no network:dhcp:nuage port
            expect_network_dhcp_nuage_port=False,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the valid CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain is empty
            expect_vm_ip_addresses_equal='')

    @nuage_test.skip_because(bug='OPENSTACK-2548')
    def test_vsd_l2_shared_unmgd_l2_unmgd_with_gw_ip_neg(self):
        # Pass on liberty, fail on kilo
        # Given I have a VSD-L2-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L2-Shared-domain without IPAM (i.e. UnManaged)
        # and these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedunmgd_lnkd_to_vsdl2domunmgd()

        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            # When I create an OS subnet with
            #   enable_dhcp == False
            #   a valid CIDR
            #   nuagenet == UUID of VSD-L2-domain
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,
            gateway_ip=None,
            cidr=VALID_CIDR,

            # Then the OS subnet has
            #   an OS allocation pool covering the full CIDR range
            #   gateway_ip equal to None
            expected_gateway_ip=None,
            #   and no network:dhcp:nuage port
            expect_network_dhcp_nuage_port=False,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the valid CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain is empty
            expect_vm_ip_addresses_equal='')

    @nuage_test.skip_because(bug='OPENSTACK-2548')
    def test_vsd_l2_shared_unmgd_l2_unmgd_no_gateway(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L2-Shared-domain without IPAM (i.e. UnManaged)
        # And these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedunmgd_lnkd_to_vsdl2domunmgd()
        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            # When I create an OS subnet with
            #     enable_dhcp == False
            #     a valid CIDR
            #     nuagenet == UUID of VSD-L2-domain
            #     no-gateway
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,
            cidr=VALID_CIDR,
            gateway_ip=None,

            # Then the OS subnet has
            # gateway_ip equal to None
            expected_gateway_ip=None,
            #   and no network:dhcp:nuage port
            expect_network_dhcp_nuage_port=False,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the valid CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain is empty
            expect_vm_ip_addresses_equal='')

    def test_vsd_l2_shared_mgd_l2_unmgd_without_gateway_with_vm(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L2-Shared-domain without IPAM (i.e. UnManaged)
        # And these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            #  When I create an OS subnet with
            #   enable_dhcp == False
            #   a valid CIDR
            #   nuagenet == UUID of VSD-L2-domain
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip=None,

            # Then the OS subnet has
            #   gateway_ip equal to None
            expected_gateway_ip=None,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the valid CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain is empty
            expect_vm_ip_addresses_equal=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_with_gw_neg_with_vm(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # And these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()

        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            #  When I create an OS subnet with
            #   enable_dhcp == False
            #   a valid CIDR
            #   nuagenet == UUID of VSD-L2-domain
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip=None,

            # Then the OS subnet has
            #   gateway_ip equal to None
            expected_gateway_ip=None,
            #   and no network:dhcp:nuage port
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS  VM-IP-address is in the valid CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain is empty
            expect_vm_ip_addresses_equal=True)

    def test_vsd_l2_shared_mgd_l2_unmgd_no_gateway_with_vm(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # And these are linked
        vsd_l2dom_unmgd = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            # When I create an OS subnet with
            #   enable_dhcp == True
            #   CIDR == CIDR of VSD-L2-Shared-domain
            #   nuagenet == UUID of VSD-L2-domain
            #   no-gateway
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip=None,

            # Then the OS subnet has
            #   gateway_ip equal to None
            expected_gateway_ip=None,
            #   and no network:dhcp:nuage port
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain equals
            # the OS VM-IP-address
            expect_vm_ip_addresses_equal=True)

    def test_vsd_l2_shared_mgd_opt3_l2_unmgd_without_gw_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom_unmgd = \
            self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
                VSD_L2_SHARED_MGD_OPT3)

        self._create_vsd_mgd_subnet(
            vsd_l2dom_unmgd,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip='',  # bad, must be VSD_L2_SHARED_MGD_OPT3
            must_fail=True)

    def test_vsd_l2_shared_mgd_opt3_l2_unmgd_with_gateway_with_vm(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # and these are linked
        vsd_l2dom_unmgd = \
            self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
                VSD_L2_SHARED_MGD_OPT3)
        self._check_vsd_l2_shared_l2_unmgd(
            vsd_l2dom_unmgd=vsd_l2dom_unmgd,
            # When I create an OS subnet with
            #  enable_dhcp == True
            #  CIDR == CIDR of VSD-L2-Shared-domain
            #  nuagenet == UUID of VSD-L2-domain
            #  gateway-ip == gateway-ip in DHCP-option-3
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip=VSD_L2_SHARED_MGD_OPT3,

            # Then the OS subnet has
            #   gateway_ip equal to DHCP-options-3 of VSD-L2-Shared-domain
            expected_gateway_ip=VSD_L2_SHARED_MGD_OPT3,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the CIDR range
            # And the VM-interface-IP-address in the VSD-L2-domain equals
            # the OS VM-IP-address
            expect_vm_ip_addresses_equal=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt3_l2_unmgd_no_gateway(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # and these are linked
        # Then I expect a failure from OS
        # Supported only when dhcp_option-3 is NOT set
        vsd_l2dom_unmgd = \
            self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
                VSD_L2_SHARED_MGD_OPT3)

        self._create_vsd_mgd_subnet(
            vsd_l2dom_unmgd,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip=None,  # bad, must be VSD_L2_SHARED_MGD_OPT3
            must_fail=True)

    def test_vsd_l3_shared_mgd_l3_unmgd_without_gateway_with_vm(self):
        # Given I have a VSD-L3-domain in a public zone
        # (i.e. without IPAM (/ UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()

        self._check_vsd_l3_shared_l2_unmgd(
            # When I create an OS subnet with
            #   enable_dhcp == True
            #   CIDR == CIDR of VSD-L3-Shared-domain
            #   nuagenet == UUID of VSD-L3-domain-public-zone-subnet
            vsd_l3_dom_subnet=vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=base_vsd_managed_networks.VSD_L3_SHARED_MGD_CIDR,
            gateway_ip='',

            # Then the OS subnet has
            #   gateway_ip equal to gateway-ip of VSD-L3-Shared-domain
            expected_gateway_ip=base_vsd_managed_networks.VSD_L3_SHARED_MGD_GW,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the  CIDR range
            # And the VM-interface-IP-address in the VSD-L3-domain equals
            # the OS VM-IP-address
            # And the VM-interface-IP-address is different from the
            # gateway_ip address
            expect_vm_ip_addresses_equal=True)

    @decorators.attr(type='smoke')
    def test_vsd_l3_shared_mgd_l3_unmgd_with_gateway_with_vm(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()

        self._check_vsd_l3_shared_l2_unmgd(
            vsd_l3_dom_subnet=vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            # When I create an OS subnet with
            #   enable_dhcp == True
            #   CIDR == CIDR of VSD-L3-Shared-domain
            #   nuagenet == UUID of VSD-L3-domain
            #   gateway-ip == gateway-ip of VSD-L3-Shared-domain
            enable_dhcp=True,
            cidr=base_vsd_managed_networks.VSD_L3_SHARED_MGD_CIDR,
            gateway_ip=base_vsd_managed_networks.VSD_L3_SHARED_MGD_GW,

            # Then the OS subnet has
            #   gateway_ip equal to gateway-ip of VSD-L3-Shared-domain
            expected_gateway_ip=base_vsd_managed_networks.VSD_L3_SHARED_MGD_GW,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,
            #
            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the CIDR range
            # And the VM-interface-IP-address in the VSD-L3-domain equals
            # the OS VM-IP-address
            # And the OS VM-IP-address is different from the gateway-ip
            expect_vm_ip_addresses_equal=True)

    def test_vsd_l3_shared_mgd_l3_unmgd_no_gateway_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()

        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip=None,  # bad, must be <base>.VSD_L3_SHARED_MGD_GW
            must_fail=True)

    def test_vsd_l3_shared_mgd_opt3_l2_unmgd_with_gateway_with_vm(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with DHCP-options-3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgdopt3_linked_to_vsdl3subnetunmgd(
                VSD_L3_SHARED_MGD_OPT3)

        self._check_vsd_l3_shared_l2_unmgd(
            vsd_l3_dom_subnet=vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,

            # When I create an OS subnet with
            #   enable_dhcp == True
            #   CIDR == CIDR of VSD-L3-Shared-domain
            #   nuagenet == UUID of VSD-L3-domain
            #   gateway-ip == gateway-ip of VSD-L3-Shared-domain
            enable_dhcp=True,
            cidr=VSD_L3_SHARED_MGD_OPT3_CIDR,
            gateway_ip=VSD_L3_SHARED_MGD_OPT3_GW,

            # Then the OS subnet has
            #   an OS allocation pool covering the full CIDR range
            # (except the GW-ip)
            #   gateway_ip equal to gateway-ip of VSD-L3-Shared-domain
            expected_gateway_ip=VSD_L3_SHARED_MGD_OPT3_GW,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the CIDR range
            # And the VM-interface-IP-address in the VSD-L3-domain equals
            # the OS VM-IP-address
            # And the OS VM-IP-address is different from the gateway-ip
            expect_vm_ip_addresses_equal=True)

    def test_vsd_l3_shared_mgd_opt3_0000_l2_unmgd_with_gateway_with_vm(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with DHCP-options-3 0.0.0.0
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgdopt3_linked_to_vsdl3subnetunmgd(
                dhcp_option_3='0.0.0.0')

        self._check_vsd_l3_shared_l2_unmgd(
            vsd_l3_dom_subnet=vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            # When I create an OS subnet with
            #   enable_dhcp == True
            #   CIDR == CIDR of VSD-L3-Shared-domain
            #   nuagenet == UUID of VSD-L3-domain
            #   gateway-ip == gateway-ip of VSD-L3-Shared-domain
            enable_dhcp=True,
            cidr=VSD_L3_SHARED_MGD_OPT3_CIDR,
            gateway_ip=VSD_L3_SHARED_MGD_OPT3_GW,

            # Then the OS subnet has
            #   an OS allocation pool covering the full CIDR range
            # (except the GW-ip)
            #   gateway_ip equal to gateway-ip of VSD-L3-Shared-domain
            expected_gateway_ip=VSD_L3_SHARED_MGD_OPT3_GW,
            #   and network:dhcp:nuage port exist from Newton onwards
            expect_network_dhcp_nuage_port=self.dhcp_port,

            # When I spin a VM in this network
            # Then the OS VM-IP-address is in the CIDR range
            # And the VM-interface-IP-address in the VSD-L3-domain equals
            # the OS VM-IP-address
            # And the OS VM-IP-address is different from the gateway-ip
            expect_vm_ip_addresses_equal=True,
        )

    # #########################################################################
    # # Negative testcases
    # #########################################################################

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_unmgd_l2_unmgd_wo_gw_enable_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain without IPAM (i.e. UnManaged)
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedunmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,  # bad
            cidr=VALID_CIDR,  # any CIDR, doesn't matter
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_wo_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        #     And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_with_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        #     And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_no_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        #     And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L2_SHARED_MGD_CIDR,
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_wo_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_unmgd_with_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=VALID_CIDR_GW,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_l2_no_gw_unmgd_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgd_lnkd_to_vsdl2domunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt3_l2_unmgd_without_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt_3_l2_unmgd_with_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip=VSD_L2_SHARED_MGD_OPT3_GW,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt_3_l2_unmgd_no_gw_no_dhcp_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=VSD_L2_SHARED_MGD_OPT3_CIDR,
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt_3_l2_unmgd_wo_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt_3_l2_unmgd_with_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=VALID_CIDR_GW,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l2_shared_mgd_opt_3_l2_unmgd_no_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L2-domain without IPAM (i.e. unmanaged)
        # And I have a VSD-L2-Shared-domain with IPAM (i.e. managed)
        # with DHCP-option 3 set
        # And these are linked
        vsd_l2dom = self._given_vsdl2sharedmgdopt3_linked_to_vsdl2domunmgd(
            VSD_L2_SHARED_MGD_OPT3)
        self._create_vsd_mgd_subnet(
            vsd_l2dom,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_wo_gw_no_dhcp_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L3_SHARED_MGD_CIDR,
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_with_gw_no_dhcp_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L3_SHARED_MGD_CIDR,
            gateway_ip=base_vsd_managed_networks.VSD_L3_SHARED_MGD_GW,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_no_gw_no_dhcp_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=False,  # bad
            cidr=base_vsd_managed_networks.VSD_L3_SHARED_MGD_CIDR,
            gateway_ip=None,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_wo_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip='',
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_with_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=VALID_CIDR_GW,
            must_fail=True)

    @decorators.attr(type=['negative'])
    def test_vsd_l3_shared_mgd_l3_unmgd_no_gw_cidr_mismatch_neg(self):
        # Given I have a VSD-L3-domain without IPAM (i.e. UnManaged)
        # And I have a VSD-L3-Shared-domain with IPAM (i.e. Managed)
        # with dhcp options 3
        # and these are linked
        vsd_l3_unmgd_subnet = \
            self._given_vsdl3sharedmgd_lnkd_to_vsdl2subnetunmgd()
        self._create_vsd_mgd_subnet(
            vsd_l3_unmgd_subnet,
            os_shared_network=self.os_shared_network,
            enable_dhcp=True,
            cidr=VALID_CIDR,  # bad
            gateway_ip=None,
            must_fail=True)
コード例 #3
0
class NuageExtraDHCPOptionsNegativeTest(
        base_nuage_extra_dhcp_options.NuageExtraDHCPOptionsBase):

    """NuageExtraDHCPOptionsNegativeTest

    Negative tests on
        port create
        port list
        port show
        port update

    v2.0 of the Neutron API is assumed. It is also assumed that the Extra
    DHCP Options extension (extra_dhcp_opt)is enabled in the
    [network-feature-enabled] section of etc/tempest.conf
    """

    @classmethod
    def resource_setup(cls):
        super(NuageExtraDHCPOptionsNegativeTest, cls).resource_setup()

        # L2 OS managed network
        cls.osmgd_l2_network = cls.create_network()
        cls.osmgd_l2_subnet = cls.create_subnet(cls.osmgd_l2_network)
        cls.os_l2_port = cls.create_port(cls.osmgd_l2_network)
        cls.l2domain = cls.nuage_client.get_l2domain(
            'externalID',
            cls.nuage_client.get_vsd_external_id(cls.osmgd_l2_subnet['id'])
        )

    @classmethod
    def skip_checks(cls):
        raise cls.skipException('Skipping negative DHCP tests.')

    def _assert_nuage_create_port_with_dhcp_opts(self, network_id,
                                                 extra_dhcp_opts):
        # Create a port with valid opt-name but invalid opt-value(s)
        self.assertRaises(exceptions.BadRequest,
                          self._create_port_with_dhcp_opts,
                          network_id,
                          extra_dhcp_opts)

    def _assert_nuage_update_port_with_dhcp_opts(self, port,
                                                 extra_dhcp_opts):
        # Update an existing port with valid opt-name but invalid opt-value(s)
        self.assertRaises(exceptions.BadRequest,
                          self._update_port_with_dhcp_opts,
                          port,
                          extra_dhcp_opts)

    def _assert_create_update_port_with_bad_dhcp_opts_neg(self, network_id,
                                                          bad_values,
                                                          opt_name):
        for opt_value in bad_values:
            extra_dhcp_opts = [
                {'opt_value': opt_value, 'opt_name': opt_name}
            ]
            self.assertRaises(exceptions.BadRequest,
                              self._create_port_with_dhcp_opts,
                              network_id,
                              extra_dhcp_opts)
            self.assertRaises(exceptions.BadRequest,
                              self._update_port_with_dhcp_opts,
                              self.os_l2_port['id'],
                              extra_dhcp_opts)

    def _create_network(self, external=False):
        if external:
            post_body = {'name': data_utils.rand_name('ext-network'),
                         'router:external': external}
        else:
            post_body = {'name': data_utils.rand_name('network')}
        body = self.admin_networks_client.create_network(**post_body)
        network = body['network']
        self.addCleanup(self.admin_networks_client.delete_network,
                        network['id'])
        return network

    def test_nuage_create_port_with_dhcp_opts_001_netmask_neg(self):
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'netmask')

    def test_nuage_create_port_with_dhcp_opts_002_time_offset_neg(self):
        # Create a port with Extra DHCP Options two's complement 32-bit integer
        network_id = self.osmgd_l2_network['id']
        bad_values = ['rubbish',
                      str(constants.MAX_UNSIGNED_INT32_PLUS_ONE),
                      VERY_LONG_STRING]
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, 'netmask')

    def test_nuage_create_port_with_dhcp_opts_003_router_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'router')

    def test_nuage_create_port_with_dhcp_opts_004_time_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        bad_values = ['rubbish',
                      str(constants.MAX_UNSIGNED_INT32_PLUS_ONE),
                      VERY_LONG_STRING]
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, 'time-server')

    def test_nuage_create_port_with_dhcp_opts_006_dns_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'dns-server')

    def test_nuage_create_port_with_dhcp_opts_007_log_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'log-server')

    def test_nuage_create_port_with_dhcp_opts_009_lpr_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'lpr-server')

    def test_nuage_create_port_with_dhcp_opts_012_hostname_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        bad_values = [
            VERY_LONG_STRING]
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, 'hostname')

    def test_nuage_create_port_with_dhcp_opts_013_boot_file_size_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'boot-file-size')

    def test_nuage_create_port_with_dhcp_opts_015_domain_name_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'domain-name')

    def test_nuage_create_port_with_dhcp_opts_016_swap_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'swap-server')

    def test_nuage_create_port_with_dhcp_opts_017_root_path_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'root-path')

    def test_nuage_create_port_with_dhcp_opts_018_extension_path_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'extension-path')

    def test_nuage_create_port_with_dhcp_opts_019_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'ip-forward-enable')

    def test_nuage_create_port_with_dhcp_opts_020_non_local_source_routing_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad  DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'non-local-source-routing')

    def test_nuage_create_port_with_dhcp_opts_021_policy_filter_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        bad_values = ['10.20.21.200;255.255.256.0',
                      '10.20.21.300;255.255.255.0',
                      '10.20.21.401;255.255.0.',
                      str(constants.MAX_UNSIGNED_INT32_PLUS_ONE),
                      VERY_LONG_STRING]
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, 'policy-filter')

    def test_nuage_create_port_with_dhcp_opts_022_max_datagram_reassembly_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'max-datagram-reassembly')

    def test_nuage_create_port_with_dhcp_opts_023_default_ttl_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'default-ttl')

    def test_nuage_create_port_with_dhcp_opts_026_mtu_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'mtu')

    def test_nuage_create_port_with_dhcp_opts_027_all_subnets_local_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'TBD')

    def test_nuage_create_port_with_dhcp_opts_028_broadcast_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'broadcast')

    def test_nuage_create_port_with_dhcp_opts_031_router_discovery_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'router-discovery')

    def test_nuage_create_port_with_dhcp_opts_032_router_solicitation_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'router-solicitation')

    # {'opt_value': '10.33.33.0;10.33.33.33;10.33.34.0;10.33.34.10',
    #  'opt_name': 'static-route'}

    def test_nuage_create_port_with_dhcp_opts_033_static_route_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad  DHCP option values
        # The minimum length of this option is 8, and the length MUST be a
        # multiple of 8.
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'static-route')

    def test_nuage_create_port_with_dhcp_opts_034_trailer_encapsulation_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'trailer-encapsulation')

    def test_nuage_create_port_with_dhcp_opts_035_arp_timeout_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        # 32-bit unsigned integer
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'arp-timeout')

    def test_nuage_create_port_with_dhcp_opts_036_ethernet_encap_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'ethernet-encap')

    def test_nuage_create_port_with_dhcp_opts_037_tcp_ttl_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        # 8-bit unsigned integer.  The minimum value is 1.
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'tcp-ttl')

    def test_nuage_create_port_with_dhcp_opts_038_tcp_keepalive_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        # 32-bit unsigned integer
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'tcp-keepalive')

    def test_nuage_create_port_with_dhcp_opts_040_nis_domain_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'nis-domain')

    def test_nuage_create_port_with_dhcp_opts_041_nis_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'nis-server')

    def test_nuage_create_port_with_dhcp_opts_042_ntp_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'ntp-server')

    def test_nuage_create_port_with_dhcp_opts_044_netbios_ns_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'netbios-ns')

    def test_nuage_create_port_with_dhcp_opts_045_netbios_dd_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'netbios-dd')

    def test_nuage_create_port_with_dhcp_opts_046_netbios_nodetype_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        # Valid values: 0x1, 0x2, 0x4, 0x8
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'netbios-nodetype')

    def test_nuage_create_port_with_dhcp_opts_047_netbios_scope_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'netbios-scope')

    def test_nuage_create_port_with_dhcp_opts_048_x_windows_fs_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'x-windows-fs')

    def test_nuage_create_port_with_dhcp_opts_049_x_windows_dm_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'x-windows-dm')

    def test_nuage_create_port_with_dhcp_opts_050_requested_address_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'requested-address')

    def test_nuage_create_port_with_dhcp_opts_060_vendor_class_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'vendor-class')

    def test_nuage_create_port_with_dhcp_opts_064_nisplus_domain_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'nis+-domain')

    def test_nuage_create_port_with_dhcp_opts_065_nisplus_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'nis+-server')

    def test_nuage_create_port_with_dhcp_opts_066_tftp_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'tftp_server')

    def test_nuage_create_port_with_dhcp_opts_067_bootfile_name_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'bootfile-name')

    def test_nuage_create_port_with_dhcp_opts_068_mobile_ip_home_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'mobile-ip-home')

    def test_nuage_create_port_with_dhcp_opts_069_smtp_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'smtp-server')

    def test_nuage_create_port_with_dhcp_opts_070_pop3_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'pop3-server')

    def test_nuage_create_port_with_dhcp_opts_071_nntp_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'nntp-server')

    def test_nuage_create_port_with_dhcp_opts_074_irc_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_IPV4_ADDRESSES, 'irc-server')

    def test_nuage_create_port_with_dhcp_opts_077_user_class_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'user-class')

    def test_nuage_create_port_with_dhcp_opts_093_client_arch_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'client-arch')

    def test_nuage_create_port_with_dhcp_opts_094_client_interface_id_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'client-interface-id')

    def test_nuage_create_port_with_dhcp_opts_097_client_machine_id_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'client-machine-id')

    def test_nuage_create_port_with_dhcp_opts_119_domain_search_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'domain-search')

    def test_nuage_create_port_with_dhcp_opts_120_sip_server_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_STRING_TYPE_VALUES, 'sip-server')

    def test_nuage_create_port_with_dhcp_opts_121_classless_static_route_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'classless-static-route')

    def test_nuage_create_port_with_dhcp_opts_125_vendor_id_encap_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'vendor-id-encap')

    def test_nuage_create_port_with_dhcp_opts_255_server_ip_address_neg(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, BAD_INTEGER_TYPE_VALUES, 'server-ip-address')

    def test_nuage_create_port_with_dhcp_opts_wrong_option(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        bad_values = ['1', '2']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, 'non-existing-option')

    def test_nuage_create_port_with_dhcp_opts_large_option_name(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        some_values = ['1', '2']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, some_values, VERY_LONG_STRING)

    def test_nuage_create_port_with_dhcp_opts_external_network_neg(self):
        # Try to create a port with  extra dhcp options on an external network
        # Should fail, as DHCP is handled externally
        ext_network = self._create_network(external=True)
        # subnet is needed for trying port creation
        ext_subnet = self.create_subnet(ext_network,
                                        manager=self.admin_manager)
        # check whether this subnet is not empty
        self.assertNotEmpty(ext_subnet)
        extra_dhcp_opts = [
            {'opt_value': '12.22.32.42', 'opt_name': 'router'}
        ]
        self.assertRaises(exceptions.BadRequest,
                          self._create_port_with_dhcp_opts,
                          ext_network['id'],
                          extra_dhcp_opts,
                          manager=self.admin_manager)

    def test_nuage_create_port_with_dhcp_opts_nuage_l2_to_l3_migr_port_neg(
            self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        extra_dhcp_opts = [
            {'opt_value': '10.20.30.40', 'opt_name': 'router'}
        ]
        # Find the device_owner = 'network:dhcp:nuage' port created by Nuage
        # when the subnet was created
        list_body = self.ports_client.list_ports()
        all_ports = list_body['ports']
        nuage_ports = [p for p in all_ports
                       if p['device_owner'] == 'network:dhcp:nuage']
        # Now fetch the one from our subnet
        our_nuage_port = [p for p in nuage_ports
                          if p['fixed_ips'][0]['subnet_id'] ==
                          self.osmgd_l2_subnet['id']]
        self.assertTrue(our_nuage_port)
        if NUAGE_FEATURES.os_managed_dualstack_subnets:
            new_nuage_port = self._update_port_with_dhcp_opts(
                our_nuage_port[0]['id'],
                extra_dhcp_opts)
            # with ipv6 patchset we don't raise exception on update of
            # nuage:dhcp owned ports (upstream allows this)
            # Openstack-1897
            self.assertIsNone(new_nuage_port)
        else:
            self.assertRaises(exceptions.BadRequest,
                              self._update_port_with_dhcp_opts,
                              our_nuage_port[0]['id'],
                              extra_dhcp_opts)

    def test_nuage_create_port_with_dhcp_opts_multiple_times_neg(
            self):
        # When specifying the the same option multiple times, it should fail
        network_id = self.osmgd_l2_network['id']
        extra_dhcp_opts = [
            {'opt_value': '19.20.30.40', 'opt_name': 'router'},
            {'opt_value': '19.20.30.41', 'opt_name': 'router'},
            {'opt_value': '19.20.30.42', 'opt_name': 'router'},
            {'opt_value': '19.20.30.43', 'opt_name': 'router'},
            {'opt_value': '19.20.30.44', 'opt_name': 'router'}
        ]

        if Topology.from_openstack('Newton') and Topology.is_ml2:
            self.assertRaises(exceptions.Conflict,
                              self._create_port_with_dhcp_opts,
                              network_id,
                              extra_dhcp_opts)
        else:
            self.assertRaises(exceptions.BadRequest,
                              self._create_port_with_dhcp_opts,
                              network_id,
                              extra_dhcp_opts)

    @decorators.attr(type='smoke')
    def test_nuage_update_port_with_dhcp_opts_multiple_times_neg(self):
        # When specifying the the same option multiple times, it should fail
        extra_dhcp_opts = [
            {'opt_value': '19.20.30.40', 'opt_name': 'router'},
            {'opt_value': '19.20.30.41', 'opt_name': 'router'},
            {'opt_value': '19.20.30.42', 'opt_name': 'router'},
            {'opt_value': '19.20.30.43', 'opt_name': 'router'},
            {'opt_value': '19.20.30.44', 'opt_name': 'router'}
        ]

        if Topology.from_openstack('Newton') and Topology.is_ml2:
            self.assertRaises(exceptions.Conflict,
                              self._update_port_with_dhcp_opts,
                              self.os_l2_port['id'],
                              extra_dhcp_opts)
        else:
            self.assertRaises(exceptions.BadRequest,
                              self._update_port_with_dhcp_opts,
                              self.os_l2_port['id'],
                              extra_dhcp_opts)

    @decorators.attr(type='smoke')
    def test_nuage_create_port_with_dhcp_opts_more_than_16_neg(self):
        # When specifying the the same option multiple times, it should fail
        more_than_16_extra_dhcp_opts = [
            {'opt_value': '255.255.255.0', 'opt_name': 'netmask'},
            {'opt_value': '200', 'opt_name': 'time-offset'},
            {'opt_value': '11.33.66.3', 'opt_name': 'router'},
            {'opt_value': '11.33.66.4', 'opt_name': 'time-server'},
            {'opt_value': '11.33.66.6', 'opt_name': 'dns-server'},
            {'opt_value': '11.33.66.7', 'opt_name': 'log-server'},
            {'opt_value': '11.33.66.9', 'opt_name': 'lpr-server'},
            {'opt_value': 'more.than.16-hostname', 'opt_name': 'hostname'},
            {'opt_value': '8192', 'opt_name': 'boot-file-size'},
            {'opt_value': 'more.than.16.domain.com',
             'opt_name': 'domain-name'},
            {'opt_value': '11.33.66.16', 'opt_name': 'swap-server'},
            {'opt_value': '/opt/more-than16/root-path',
             'opt_name': 'root-path'},
            {'opt_value': '/opt/more-than16/extension-path',
             'opt_name': 'extension-path'},
            {'opt_value': '1', 'opt_name': 'ip-forward-enable'},
            {'opt_value': '1', 'opt_name': 'non-local-source-routing'},
            {'opt_value': '1576', 'opt_name': 'max-datagram-reassembly'},
            {'opt_value': '150', 'opt_name': 'default-ttl'},
            {'opt_value': '2104', 'opt_name': 'mtu'}
        ]
        self.assertRaises(exceptions.BadRequest,
                          self._create_port_with_dhcp_opts,
                          self.osmgd_l2_network['id'],
                          more_than_16_extra_dhcp_opts)

    def test_nuage_show_port_non_existent_neg(self):
        # Try to show the extra dhcp options of a non-existent port
        bad_port_id = 'blablablabla'
        self.assertRaises(exceptions.NotFound,
                          self.ports_client.show_port,
                          bad_port_id)

    @decorators.attr(type='smoke')
    @testtools.skipIf(Topology.before_openstack('queens'),
                      'Unsupported pre-queens')
    def test_nuage_create_port_with_dhcp_opts_wrong_numerical_option(self):
        # Try to create a port with bad extra dhcp options values
        # Try to update an existing port with these bad DHCP option values
        network_id = self.osmgd_l2_network['id']
        bad_values = ['1', '2']
        self._assert_create_update_port_with_bad_dhcp_opts_neg(
            network_id, bad_values, '0')

    @decorators.attr(type='smoke')
    @testtools.skipIf(Topology.before_openstack('queens'),
                      'Unsupported pre-queens')
    def test_nuage_create_port_with_dhcp_opts_mixed_numerical_option(self):
        extra_dhcp_opts = [
            {'opt_value': 'nuage.net', 'opt_name': 'hostname'}]
        self._update_port_with_dhcp_opts(
            self.os_l2_port['id'],
            extra_dhcp_opts
        )
        extra_dhcp_opts = [
            {'opt_value': 'nuage.net', 'opt_name': '12'}]
        self.assertRaises(exceptions.BadRequest,
                          self._update_port_with_dhcp_opts,
                          self.os_l2_port['id'],
                          extra_dhcp_opts)