examples: updated python switch example to show the need to use ids for switch/hub interfaces
This commit is contained in:
parent
568b1360a2
commit
c6898c7c0e
1 changed files with 7 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
from core.api.grpc import client
|
from core.api.grpc import client, wrappers
|
||||||
from core.api.grpc.wrappers import NodeType, Position
|
from core.api.grpc.wrappers import NodeType, Position
|
||||||
|
|
||||||
# interface helper
|
# interface helper
|
||||||
|
@ -20,10 +20,12 @@ position = Position(x=300, y=100)
|
||||||
node2 = session.add_node(3, position=position)
|
node2 = session.add_node(3, position=position)
|
||||||
|
|
||||||
# create links
|
# create links
|
||||||
iface1 = iface_helper.create_iface(node1.id, 0)
|
node1_iface1 = iface_helper.create_iface(node1.id, 0)
|
||||||
session.add_link(node1=node1, node2=switch, iface1=iface1)
|
switch_iface1 = wrappers.Interface(0)
|
||||||
iface1 = iface_helper.create_iface(node2.id, 0)
|
session.add_link(node1=node1, node2=switch, iface1=node1_iface1, iface2=switch_iface1)
|
||||||
session.add_link(node1=node2, node2=switch, iface1=iface1)
|
node2_iface1 = iface_helper.create_iface(node2.id, 0)
|
||||||
|
switch_iface2 = wrappers.Interface(1)
|
||||||
|
session.add_link(node1=node2, node2=switch, iface1=node2_iface1, iface2=switch_iface2)
|
||||||
|
|
||||||
# start session
|
# start session
|
||||||
core.start_session(session)
|
core.start_session(session)
|
||||||
|
|
Loading…
Reference in a new issue