networking_generic_switch

del_network

def _unplug_port_from_network(self, port, network):

server.log:37075:2020-06-08 10:12:54.569 56546 INFO networking_generic_switch.generic_switch_mech [req-ae58f7b8-349a-4a34-88e0-b90630e7f9b1 fde919fba81146bfa6a74a5a8e483f45 42272601916748e2ba64d8a1c5413ba4 - default default] Port 2f9287aa-3697-4cd2-ab97-00445055209a has been unplugged from network 1fcf749d-8e67-40ad-8718-e5daa85453fc on device JG05-SA-01-CE8850

 

 delete_port

 devices/netmiko_devices/__init__.py 

def bind_port(self, context):
      464             LOG.debug("Putting port {port} on {switch_info} to vlan: "
465                       "{segmentation_id}".format(
466                           port=port_id,
467                           switch_info=switch_info,
468                           segmentation_id=segmentation_id))
469             # Move port to network
470             switch.plug_port_to_network(port_id, segmentation_id)
471             LOG.info("Successfully bound port %(port_id)s in segment "
472                      "%(segment_id)s on device %(device)s"
server.log-20200607:80316:2020-06-06 19:51:23.516 56544 INFO networking_generic_switch.generic_switch_mech [req-2b81fb5c-41cf-4d87-8338-3087e8aa9e6b 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Successfully bound port 1bada3f6-5bbe-411a-93cf-2b9cec5b1aa4 in segment 1 on device JG05-SA-01-CE8850
server.log-20200607:81028:2020-06-06 19:59:43.502 56544 INFO networking_generic_switch.generic_switch_mech [req-ba834ab1-d6fc-40aa-bd7b-fabe60f1d743 fde919fba81146bfa6a74a5a8e483f45 42272601916748e2ba64d8a1c5413ba4 - default default] Successfully bound port d9cf0597-0cc4-4526-8511-856729e3c460 in segment 101 on device JG05-SA-01-CE8850
def plug_port_to_network(self, port, segmentation_id):
183         self.send_commands_to_device(
184             self._format_commands(self.PLUG_PORT_TO_NETWORK,
185                                   port=port,
186                                   segmentation_id=segmentation_id))
create_network_postcommit
devices/netmiko_devices/__init__.py
154     def add_network(self, segmentation_id, network_id):
155         # NOTE(zhenguo): Remove dashes from uuid as on most devices 32 chars
156         # is the max length of vlan name.
157         network_id = uuid.UUID(network_id).hex
158         cmds = self._format_commands(self.ADD_NETWORK,
159                                      segmentation_id=segmentation_id,
160                                      network_id=network_id)
161         for port in self._get_trunk_ports():
162             cmds += self._format_commands(self.ADD_NETWORK_TO_TRUNK,
163                                           port=port,
164                                           segmentation_id=segmentation_id)
165         self.send_commands_to_device(cmds)
networking_generic_switch/devices/netmiko_devices/huawei_vrpv8.py

104954 [~JG05-SA-01-CE8850-100GE1/0/14]undo port default vlan 1
104955                                           ^
104956 Error: Unrecognized command found at '^' position
62733 [~JG05-SA-01-CE8850-100GE1/0/14]undo port default vlan 101^M
 62734                                           ^^M
 62735 Error: Unrecognized command found at '^' position.^M
 62736 [~JG05-SA-01-CE8850-100GE1/0/14]commit^M
2020-06-08 15:13:38.775 14393 DEBUG neutron.plugins.ml2.drivers.mech_agent [req-03577785-c23e-4886-9bd8-c482f2b564e3 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Checking segment: {'network_id': '1fcf749d-8e67-40ad-8718-e5daa85453fc', 'segmentation_id': 1, 'physical_network': u'physnet_vlan', 'id': 'e8aa135b-5d2d-4d2a-a341-d35fa89c069f', 'network_type': u'vlan'} for mappings: {u'physnet_vlan': u'yes'} with network types: ['flat', 'vlan'] check_segment_for_agent /usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/mech_agent.py:236
2020-06-08 15:13:38.803 14393 DEBUG neutron.plugins.ml2.drivers.mech_agent [req-03577785-c23e-4886-9bd8-c482f2b564e3 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Bound using segment: {'network_id': '1fcf749d-8e67-40ad-8718-e5daa85453fc', 'segmentation_id': 1, 'physical_network': u'physnet_vlan', 'id': 'e8aa135b-5d2d-4d2a-a341-d35fa89c069f', 'network_type': u'vlan'} bind_port /usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/mech_agent.py:108
117123 2020-06-08 16:03:35.711 25633 INFO neutron.notifiers.nova [-] Nova event response: {u'status':                    u'completed', u'tag': u'3babb12a-cf99-451e-bddb-dff148623473', u'name': u'network-vif-plugged',                   u'server_uuid': u'c5236717-5e18-47f4-95a7-4465b0685a79', u'code': 200}
原文地址:https://www.cnblogs.com/dream397/p/13064145.html