[Neutron]

Bino Oetomo bino at jogjacamp.co.id
Sat Dec 8 23:49:07 UTC 2018


Dear Kaplonski sir.

Thankyou for your help.

Actualy, the one that I paste is not my first try.
It's the result after I blindly trying add more and more parameters into
body.

Ok,
I will try your sugestion and make a call using very minimal parameters per
https://docs.openstack.org/ocata/user-guide/sdk-neutron-apis.html#create-router-and-add-port-to-subnet

body_value = {'port': {
        'admin_state_up': True,
        'device_id': router_device_id,
        'name': 'port1',
        'network_id': network_id,
        }}


I'll back to this list.
Sincerely
-bino-
On Sat, Dec 8, 2018 at 9:42 PM Slawomir Kaplonski <skaplons at redhat.com>
wrote:

> Hi,
>
> You shouldn’t create port with router as device owner. If You want to
> connect port or subnet to router, there is proper method for that:
> https://developer.openstack.org/api-ref/network/v2/?expanded=add-interface-to-router-detail#add-interface-to-router
>
>> Slawek Kaplonski
> Senior software engineer
> Red Hat
>
> > Wiadomość napisana przez Bino Oetomo <bino at jogjacamp.co.id> w dniu
> 08.12.2018, o godz. 02:42:
> >
> > Dear All.
> >
> > I have no problem configuring network via Hosrizon-dasboard.
> >
> > I start playing with python for some task.
> > I got succsess in creating network.
> > I create a router, with one interface connected to existing
> 'ext-network' .. success.
> >
> > But I fail when I try to add a port to that router for connecting to
> existing internal network.
> >
> > Here is part of my python shell.
> >
> > --------------------
> > body_value = {
> >
> >
> > 'port': {
> >
> >
> > 'admin_state_up': True,
> >
> >
> > 'device_owner': 'network:router_interface',
> >
> >
> > 'device_id': 'a616dcc0-1f72-4424-9494-4d13b42445ee',
> >
> >
> > 'name': 'Bino-net-01-02',
> >
> >
> > 'network_id': 'dfc8ed54-106d-48d0-8b45-cbd3cf0fbb79',
> >
> >
> > 'binding:host_id': 'rocky-controller.mynet.net',
> >
> >
> > 'binding:profile': {},
> >
> >
> > 'binding:vnic_type': 'normal',
> >
> >
> > 'fixed_ips': [{
> >
> >
> > 'subnet_id': 'c71a86a3-f9a8-4e60-828e-5d6f87e58ac9',
> >
> >
> > 'ip_address': '192.168.202.254'
> >
> >
> > }],
> >
> >
> > }
> > }
> >
> >
> > response
> > = nt.create_port(body=body_value)
> >
> > response
> >
> >
> > {'port': {'allowed_address_pairs': [], 'extra_dhcp_opts': [],
> 'updated_at': '2018-12-07T08:10:24Z', 'device_owner':
> 'network:router_interface', 'revision_number': 1, 'port_security_enabled':
> False, 'binding:profile': {}, 'fixed_ips': [{'subnet_id':
> 'c71a86a3-f9a8-4e60-828e-5d6f87e58ac9', 'ip_address': '192.168.202.254'}],
> 'id': 'd02eb0f0-663f-423f-af4e-c969ccb9dc25', 'security_groups': [],
> 'binding:vif_details': {'port_filter': True, 'datapath_type': 'system',
> 'ovs_hybrid_plug': True}, 'binding:vif_type': 'ovs', 'mac_address':
> 'fa:16:3e:e2:9d:8f', 'project_id': 'c0b89f614b5a457cb5acef8fe8c2b320',
> 'status': 'DOWN', 'binding:host_id': 'rocky-controller.mynet.net',
> 'description': '', 'tags': [], 'device_id':
> 'a616dcc0-1f72-4424-9494-4d13b42445ee', 'name': 'Bino-net-01-02',
> 'admin_state_up': True, 'network_id':
> 'dfc8ed54-106d-48d0-8b45-cbd3cf0fbb79', 'tenant_id':
> 'c0b89f614b5a457cb5acef8fe8c2b320', 'created_at': '2018-12-07T08:10:24Z',
> 'binding:vnic_type': 'normal'}}
> >
> > --------------------
> > 'status' always 'DOWN'.
> >
> > Kindly please give me some clue to fix this problem
> >
> > Note : Actualy I post same question on stackexchange :
> https://stackoverflow.com/questions/53665795/openstack-python-neutronclient-creating-port-but-down
> >
> > Sincerely
> > -bino-
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20181209/ecf6b65e/attachment.html>


More information about the openstack-discuss mailing list