Exemplo n.º 1
0
 def _check_vif_type_for_vnic_type(self, vnic_type,
                                   expected_vif_type):
     context = base.FakePortContext(self.AGENT_TYPE,
                                    self.AGENTS,
                                    self.VLAN_SEGMENTS,
                                    vnic_type)
     self.driver.bind_port(context)
     self.assertEqual(expected_vif_type, context._bound_vif_type)
Exemplo n.º 2
0
    def test_vif_details_contains_physical_net(self):
        VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
                          api.NETWORK_TYPE: 'vlan',
                          api.PHYSICAL_NETWORK: 'fake_physical_network',
                          api.SEGMENTATION_ID: 1234}]

        context = base.FakePortContext(self.AGENT_TYPE,
                                       self.AGENTS,
                                       VLAN_SEGMENTS,
                                       portbindings.VNIC_DIRECT)
        segment = VLAN_SEGMENTS[0]
        agent = self.AGENTS[0]
        self.driver.try_to_bind_segment_for_agent(context, segment, agent)
        set({"physical_network": "fake_physical_network"}).issubset(
            set(context._bound_vif_details.items()))
Exemplo n.º 3
0
    def test_profile_contains_physical_net(self):
        VLAN_SEGMENTS = [{
            api.ID: 'vlan_segment_id',
            api.NETWORK_TYPE: 'vlan',
            api.PHYSICAL_NETWORK: 'fake_physical_network',
            api.SEGMENTATION_ID: 1234
        }]

        context = base.FakePortContext(self.AGENT_TYPE, self.AGENTS,
                                       VLAN_SEGMENTS, portbindings.VNIC_DIRECT)
        context._binding = mock.Mock()
        context._binding.profile = {}
        segment = VLAN_SEGMENTS[0]
        agent = self.AGENTS[0]
        self.driver.try_to_bind_segment_for_agent(context, segment, agent)
        self.assertEqual('{"physical_network": "fake_physical_network"}',
                         context._binding.profile)