Ejemplo n.º 1
0
    def create_port(self, context, port):
        LOG.debug(_("create_port with %s"), port)
        session = context.session
        port_data = port['port']
        with session.begin(subtransactions=True):
            self._ensure_default_security_group_on_port(context, port)
            sgids = self._get_security_groups_on_port(context, port)
            # Set port status as 'DOWN'. This will be updated by agent
            port['port']['status'] = q_const.PORT_STATUS_DOWN

            vnic_type = self._process_port_binding_create(context,
                                                          port['port'])

            port = super(MellanoxEswitchPlugin,
                         self).create_port(context, port)

            self._process_portbindings_create_and_update(context,
                                                         port_data,
                                                         port)
            db.add_port_profile_binding(context.session, port['id'], vnic_type)

            self._process_port_create_security_group(
                context, port, sgids)
        self.notify_security_groups_member_updated(context, port)
        return self._extend_port_dict_binding(context, port)
Ejemplo n.º 2
0
    def test_add_port_profile_binding(self):
        with self.port() as port:
            TEST_PORT_ID = port['port']['id']
            VNIC_TYPE = 'normal'

            self.assertIsNone(
                mlnx_db.get_port_profile_binding(self.session, TEST_PORT_ID))
            mlnx_db.add_port_profile_binding(self.session, TEST_PORT_ID,
                                             VNIC_TYPE)
            binding = mlnx_db.get_port_profile_binding(self.session,
                                                       TEST_PORT_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.port_id, TEST_PORT_ID)
            self.assertEqual(binding.vnic_type, VNIC_TYPE)

            self.assertTrue(repr(binding))
Ejemplo n.º 3
0
    def test_add_port_profile_binding(self):
        with self.port() as port:
            TEST_PORT_ID = port['port']['id']
            VNIC_TYPE = 'normal'

            self.assertIsNone(mlnx_db.get_port_profile_binding(self.session,
                                                               TEST_PORT_ID))
            mlnx_db.add_port_profile_binding(self.session,
                                             TEST_PORT_ID,
                                             VNIC_TYPE)
            binding = mlnx_db.get_port_profile_binding(self.session,
                                                       TEST_PORT_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.port_id, TEST_PORT_ID)
            self.assertEqual(binding.vnic_type, VNIC_TYPE)

            self.assertTrue(repr(binding))
Ejemplo n.º 4
0
 def create_port(self, context, port):
     LOG.debug(_("create_port with %s"), port)
     vnic_type = self._process_port_binding_create(context, port['port'])
     port = super(MellanoxEswitchPlugin, self).create_port(context, port)
     db.add_port_profile_binding(context.session, port['id'], vnic_type)
     return self._extend_port_dict_binding(context, port)
 def create_port(self, context, port):
     LOG.debug(_("create_port with %s"), port)
     vnic_type = self._process_port_binding_create(context, port['port'])
     port = super(MellanoxEswitchPlugin, self).create_port(context, port)
     db.add_port_profile_binding(context.session, port['id'], vnic_type)
     return self._extend_port_dict_binding(context, port)