<div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><div><div><div>Dear Kaplonski sir.<br><br></div>Thankyou for your help.<br><br></div>Actualy, the one that I paste is not my first try.<br></div>It's the result after I blindly trying add more and more parameters into body.<br><br></div>Ok, <br></div>I will try your sugestion and make a call using very minimal parameters per <a href="https://docs.openstack.org/ocata/user-guide/sdk-neutron-apis.html#create-router-and-add-port-to-subnet">https://docs.openstack.org/ocata/user-guide/sdk-neutron-apis.html#create-router-and-add-port-to-subnet</a><br><br><pre><span class="gmail-n">body_value</span> <span class="gmail-o">=</span> <span class="gmail-p">{</span><span class="gmail-s1">'port'</span><span class="gmail-p">:</span> <span class="gmail-p">{</span>
        <span class="gmail-s1">'admin_state_up'</span><span class="gmail-p">:</span> <span class="gmail-bp">True</span><span class="gmail-p">,</span>
        <span class="gmail-s1">'device_id'</span><span class="gmail-p">:</span> <span class="gmail-n">router_device_id</span><span class="gmail-p">,</span>
        <span class="gmail-s1">'name'</span><span class="gmail-p">:</span> <span class="gmail-s1">'port1'</span><span class="gmail-p">,</span>
        <span class="gmail-s1">'network_id'</span><span class="gmail-p">:</span> <span class="gmail-n">network_id</span><span class="gmail-p">,</span>
        <span class="gmail-p">}}</span></pre><div><div><div><div><div><div><br></div><div>I'll back to this list.<br></div><div>Sincerely<br></div><div>-bino-<br></div><div><div class="gmail_quote"><div dir="ltr">On Sat, Dec 8, 2018 at 9:42 PM Slawomir Kaplonski <<a href="mailto:skaplons@redhat.com">skaplons@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
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: <a href="https://developer.openstack.org/api-ref/network/v2/?expanded=add-interface-to-router-detail#add-interface-to-router" rel="noreferrer" target="_blank">https://developer.openstack.org/api-ref/network/v2/?expanded=add-interface-to-router-detail#add-interface-to-router</a><br>
<br>
— <br>
Slawek Kaplonski<br>
Senior software engineer<br>
Red Hat<br>
<br>
> Wiadomość napisana przez Bino Oetomo <<a href="mailto:bino@jogjacamp.co.id" target="_blank">bino@jogjacamp.co.id</a>> w dniu 08.12.2018, o godz. 02:42:<br>
> <br>
> Dear All.<br>
> <br>
> I have no problem configuring network via Hosrizon-dasboard.<br>
> <br>
> I start playing with python for some task.<br>
> I got succsess in creating network.<br>
> I create a router, with one interface connected to existing 'ext-network' .. success.<br>
> <br>
> But I fail when I try to add a port to that router for connecting to existing internal network.<br>
> <br>
> Here is part of my python shell.<br>
> <br>
> --------------------<br>
> body_value = {<br>
> <br>
>     <br>
> 'port': {<br>
> <br>
>         <br>
> 'admin_state_up': True,<br>
> <br>
>         <br>
> 'device_owner': 'network:router_interface',<br>
> <br>
>         <br>
> 'device_id': 'a616dcc0-1f72-4424-9494-4d13b42445ee',<br>
> <br>
>         <br>
> 'name': 'Bino-net-01-02',<br>
> <br>
>         <br>
> 'network_id': 'dfc8ed54-106d-48d0-8b45-cbd3cf0fbb79',<br>
> <br>
>         <br>
> 'binding:host_id': '<a href="http://rocky-controller.mynet.net" rel="noreferrer" target="_blank">rocky-controller.mynet.net</a>',<br>
> <br>
>         <br>
> 'binding:profile': {},<br>
> <br>
>         <br>
> 'binding:vnic_type': 'normal',<br>
> <br>
>         <br>
> 'fixed_ips': [{<br>
> <br>
>             <br>
> 'subnet_id': 'c71a86a3-f9a8-4e60-828e-5d6f87e58ac9',<br>
> <br>
>             <br>
> 'ip_address': '192.168.202.254'<br>
> <br>
>             <br>
> }],<br>
> <br>
>     <br>
> }<br>
> }<br>
> <br>
> <br>
> response <br>
> = nt.create_port(body=body_value)<br>
> <br>
> response<br>
> <br>
>   <br>
> {'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': '<a href="http://rocky-controller.mynet.net" rel="noreferrer" target="_blank">rocky-controller.mynet.net</a>', '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'}}<br>
> <br>
> --------------------<br>
> 'status' always 'DOWN'.<br>
> <br>
> Kindly please give me some clue to fix this problem<br>
> <br>
> Note : Actualy I post same question on stackexchange : <a href="https://stackoverflow.com/questions/53665795/openstack-python-neutronclient-creating-port-but-down" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/53665795/openstack-python-neutronclient-creating-port-but-down</a><br>
> <br>
> Sincerely<br>
> -bino-<br>
<br>
</blockquote></div></div></div></div></div></div></div></div></div></div>