def test_nexus_vxlan_one_network_two_hosts(self):

        # Configure bound segments to indicate VXLAN+VLAN.
        self.mock_top_bound_segment.return_value = BOUND_SEGMENT_VXLAN
        self.mock_bottom_bound_segment.return_value = BOUND_SEGMENT1

        # Create port and verify database entry.
        @contextlib.contextmanager
        def _create_port(host_id, device_id):
            with self.port(subnet=subnet, fmt=self.fmt) as port:
                data = {'port': {portbindings.HOST_ID: host_id,
                                 'device_id': device_id,
                                 'device_owner': DEVICE_OWNER,
                                 'admin_state_up': True}}
                result = self.new_update_request('ports', data,
                                    port['port']['id']).get_response(self.api)
                self.assertEqual(result.status_int, wexc.HTTPOk.code)
                binding = nexus_db_v2.get_nve_vni_member_bindings(
                                    VNI, NEXUS_IP_ADDR, device_id)
                self.assertEqual(1, len(binding))
                yield
            self._delete('ports', port['port']['id'])

        # Create network, subnet and two ports (two hosts).
        # Verify that each _create_port call creates database entries.
        # Verify that the second _create_port call does not configure
        # the switch. Only the first port create call per vni/switch
        # configures the switch.
        with self.network(name=NETWORK_NAME) as network:
            with self.subnet(network=network, cidr=CIDR_1) as subnet:
                with _create_port(COMP_HOST_NAME, DEVICE_ID_1):
                    self.mock_ncclient.reset_mock()
                    with _create_port(COMP_HOST_NAME_2, DEVICE_ID_2):
                        assert not self.mock_ncclient.connect.called
Create a ByteParser on demand.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py/TestCiscoPortsV2.test_nexus_vxlan_one_network_two_hosts--crossover with--dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/coverage/parser.py/CodeParser._get_byte_parser