Neutron Port Create

Asked by Akilesh on 2014-01-08

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

English Edit question
neutron Edit question
No assignee Edit question
Solved by:
Salvatore Orlando
Last query:
Last reply:
Sumit Naiksatam (snaiksat) said : #1

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

yong sheng gong (gongysh) said : #2

    def _ovs_add_port(self, bridge, device_name, port_id, mac_address,
        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,
                '--', 'set', 'Interface', device_name,
                'external-ids:attached-mac=%s' % mac_address]
        utils.execute(cmd, self.root_helper)

This question has probably been answered here as well:

Akilesh (akilesh1597) said : #4

Thanks Salvatore Orlando, that solved my question.