Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why datapath id is registered with integer type in ryu/app/simple_switch_rest_13.py ? #171

Open
AlfredChaos opened this issue Aug 3, 2022 · 0 comments

Comments

@AlfredChaos
Copy link

When I learned Ryu Rest, I found that the datapath ID is set to int at registration time

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
    super(SimpleSwitchRest13, self).switch_features_handler(ev)
    datapath = ev.msg.datapath
    self.switches[datapath.id] = datapath
    self.mac_to_port.setdefault(datapath.id, {})

so mac_to_port = {1: {}}
however, when updating mac_to_port with api, i got dpid is a string, and decorator validates string the dpid.

@route('simpleswitch', url, methods=['PUT'],
     requirements={'dpid': dpid_lib.DPID_PATTERN})

then, string dpid "0000000000000001" not in mac_to_port, return 404.

if dpid not in simple_switch.mac_to_port:
    return Response(status=404)

if i reset bridge datapath-id with command ovs-vsctl set bridge br0 other-config:datapath-id=<random string>, then got random number from event message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant