Neutron Port Create

Asked by Akilesh

I see that neutron port-create does not create a port on openvswith. Instead it only creates it in db. I would like to know what has to be done to really create a ovs port. I want a service to bind to the port I created. Below is my guess of how to solve the problem.

Correct me If I am wrong.

1. Use Neutron port create to get mac address and fixed ip of the device
2. Create a tap device with the mac address and assign the fixed ip to it
3. Add the tap device to openvswitch using ovs-vsctl add-port
4. Bind my program to the port and proceed.

If any one got any suggestion for better strategy please do let me know.

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
Salvatore Orlando
Solved:
Last query:
Last reply:
Revision history for this message
Sumit Naiksatam (snaiksat) said :
#1

Check out agent/linux/interface.py. The drivers defined here implement plug/unplug operation which do what you are trying to achieve.

Revision history for this message
yong sheng gong (gongysh) said :
#2

    def _ovs_add_port(self, bridge, device_name, port_id, mac_address,
                      internal=True):
        cmd = ['ovs-vsctl', '--', '--may-exist',
               'add-port', bridge, device_name]
        if internal:
            cmd += ['--', 'set', 'Interface', device_name, 'type=internal']
        cmd += ['--', 'set', 'Interface', device_name,
                'external-ids:iface-id=%s' % port_id,
                '--', 'set', 'Interface', device_name,
                'external-ids:iface-status=active',
                '--', 'set', 'Interface', device_name,
                'external-ids:attached-mac=%s' % mac_address]
        utils.execute(cmd, self.root_helper)

Revision history for this message
Best Salvatore Orlando (salvatore-orlando) said :
#3

This question has probably been answered here as well: http://www.gossamer-threads.com/lists/openstack/dev/34719

Revision history for this message
Akilesh (akilesh1597) said :
#4

Thanks Salvatore Orlando, that solved my question.