{"action":"created","issue":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/278","repository_url":"https://api.github.com/repos/svinota/pyroute2","labels_url":"https://api.github.com/repos/svinota/pyroute2/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/svinota/pyroute2/issues/278/comments","events_url":"https://api.github.com/repos/svinota/pyroute2/issues/278/events","html_url":"https://github.com/svinota/pyroute2/issues/278","id":171564938,"number":278,"title":"Existing bridge interfaces do not store already existing ports","user":{"login":"Callum027","id":2997843,"avatar_url":"https://avatars.githubusercontent.com/u/2997843?v=3","gravatar_id":"","url":"https://api.github.com/users/Callum027","html_url":"https://github.com/Callum027","followers_url":"https://api.github.com/users/Callum027/followers","following_url":"https://api.github.com/users/Callum027/following{/other_user}","gists_url":"https://api.github.com/users/Callum027/gists{/gist_id}","starred_url":"https://api.github.com/users/Callum027/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Callum027/subscriptions","organizations_url":"https://api.github.com/users/Callum027/orgs","repos_url":"https://api.github.com/users/Callum027/repos","events_url":"https://api.github.com/users/Callum027/events{/privacy}","received_events_url":"https://api.github.com/users/Callum027/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/svinota/pyroute2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/svinota/pyroute2/labels/fixed","name":"fixed","color":"009800"},{"url":"https://api.github.com/repos/svinota/pyroute2/labels/waiting%20for%20feedback","name":"waiting for feedback","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-17T03:13:36Z","updated_at":"2016-08-18T22:36:51Z","closed_at":null,"body":"When you add a new bridge interface using pyroute2 and add a port to it, everything works as expected. However, when pyroute2 inherits a bridge interface with ports added to it, those ports don't show up in pyroute2. This can result in a situation where you can add an interface to a bridge twice, and pyroute2 doesn't like it.\r\n\r\nTest script:\r\n```python\r\n#!/usr/bin/python3\r\n\r\nimport pyroute2\r\n\r\nnetns = pyroute2.NetNS(\"foo\")\r\nipdb = pyroute2.IPDB(nl=netns)\r\n\r\ntestdummy0 = None\r\ntestbr0 = None\r\n\r\nif \"testdummy0\" in ipdb.by_name.keys():\r\n    testdummy0 = ipdb.interfaces[\"testdummy0\"]\r\nelse:\r\n    testdummy0 = ipdb.create(ifname=\"testdummy0\", kind=\"dummy\")\r\n    ipdb.commit()\r\n\r\nif \"testbr0\" in ipdb.by_name.keys():\r\n    testbr0 = ipdb.interfaces[\"testbr0\"]\r\nelse:\r\n    testbr0 = ipdb.create(ifname=\"testbr0\", kind=\"bridge\")\r\n    ipdb.commit()\r\n\r\nprint(\"testbr0 bridge ports (before): %s\" % testbr0.ports)\r\n\r\nif testdummy0.index not in testbr0.ports:\r\n    print(\"testdummy0 added\")\r\n    testbr0.add_port(testdummy0).commit()\r\nelse:\r\n    print(\"testdummy0 not added\")\r\n\r\nprint(\"testbr0 bridge ports (after): %s\" % testbr0.ports)\r\n\r\nipdb.release()\r\nnetns.close()\r\n```\r\n\r\nOutput (ran once, then ran immediately after):\r\n```\r\n(pyroute2-venv) root@ubuntu:~# python3 test.py\r\ntestbr0 bridge ports (before): []\r\ntestdummy0 added\r\ntestbr0 bridge ports (after): [2]\r\n\r\n(pyroute2-venv) root@ubuntu:~# python3 test.py\r\ntestbr0 bridge ports (before): []\r\ntestdummy0 added\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 27, in <module>\r\n    testbr0.add_port(testdummy0).commit()\r\n  File \"/root/pyroute2-venv/lib/python3.4/site-packages/pyroute2/ipdb/interface.py\", line 905, in commit\r\n    raise error\r\n  File \"/root/pyroute2-venv/lib/python3.4/site-packages/pyroute2/ipdb/interface.py\", line 686, in commit\r\n    raise CommitException('ports target is not set')\r\npyroute2.ipdb.exceptions.CommitException: ports target is not set\r\n```"},"comment":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/comments/240878002","html_url":"https://github.com/svinota/pyroute2/issues/278#issuecomment-240878002","issue_url":"https://api.github.com/repos/svinota/pyroute2/issues/278","id":240878002,"user":{"login":"Callum027","id":2997843,"avatar_url":"https://avatars.githubusercontent.com/u/2997843?v=3","gravatar_id":"","url":"https://api.github.com/users/Callum027","html_url":"https://github.com/Callum027","followers_url":"https://api.github.com/users/Callum027/followers","following_url":"https://api.github.com/users/Callum027/following{/other_user}","gists_url":"https://api.github.com/users/Callum027/gists{/gist_id}","starred_url":"https://api.github.com/users/Callum027/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Callum027/subscriptions","organizations_url":"https://api.github.com/users/Callum027/orgs","repos_url":"https://api.github.com/users/Callum027/repos","events_url":"https://api.github.com/users/Callum027/events{/privacy}","received_events_url":"https://api.github.com/users/Callum027/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T22:36:50Z","updated_at":"2016-08-18T22:36:50Z","body":"Thanks for getting onto it so quickly. All fixed on my end as well."}}
{"actor":{"display_login":"Callum027"}}