core icon indicating copy to clipboard operation
core copied to clipboard

distributed-how to config node's services with gprc?only should use python's example?

Open www-uu opened this issue 1 year ago • 2 comments

Describe follow examples: https://github.com/coreemu/core/blob/master/package/examples/grpc/distributed_switch.py https://github.com/coreemu/core/blob/master/package/examples/configservices/switch.py

seems not support options in core.api.grpc.wrappers.Session.add_node

Traceback (most recent call last):
  File "/home/demo/n.py", line 340, in createNode
    node_obj = self.session.add_node(_id=_id, name=_name, model=_model, position=_position, server=_server, options=options)
TypeError: Session.add_node() got an unexpected keyword argument 'options

www-uu avatar Mar 25 '24 09:03 www-uu

the add_node function on the wrapper object here is just a convenience that takes a few of the typical parameters. You can manually set anything on a node after creation when returned. I am not sure what you are trying to do.

You cannot mix usage of gRPC and direct python together. That will never work.

bharnden avatar Mar 25 '24 14:03 bharnden

the add_node function on the wrapper object here is just a convenience that takes a few of the typical parameters. You can manually set anything on a node after creation when returned. I am not sure what you are trying to do.

You cannot mix usage of gRPC and direct python together. That will never work.

1.You can manually set anything on a node after creation when returned. How to set config_services with gRPC, any example? Haven't found yet.

Already tried this, but it will become nothing happen:

node_obj = self.session.add_node(_id=_id, name=_name, model="router", position=_position, server=_server)
node_obj.config_services = ["zebra","OSFPv2", "IPForward"]  #["OSFPv2", "IPForward"]

session.add_link

coreemu.start_session(session)

2.You cannot mix usage of gRPC and direct python together, just use gRPC, but as compare found python example support "options" parameter. https://github.com/coreemu/core/blob/master/package/examples/python/distributed_switch.py

node2 = session.add_node(CoreNode, options=options)

www-uu avatar Mar 26 '24 01:03 www-uu