...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
ApplicationId myAppId = ...; DeviceId myDeviceId = ...'' Bmv2DeviceContext myContext = ...; Bmv2Configuration myConfiguration = myContext.configuration(); Ip4Prefix dstPrefix = Ip4Prefix.valueOf("192.16.184.0/24"); ExtensionSelector extSelector = Bmv2ExtensionSelector.builder() .forConfiguration(myConfiguration) .matchExact("standard_metadata", "ingress_port", 10) .matchLpm("ipv4", "dstAddr", dstPrefix.address().toOctets(), dstPrefix.prefixLength()) .build(); ExtensionTreatment extTreatment = Bmv2ExtensionTreatment.builder() .forConfiguration(myConfiguration) .setActionName("next_hop") .addParameter("nhop_id", 4) .build(); FlowRule rule = DefaultFlowRule.builder() .forDevice(myDeviceId) .fromApp(myAppId) .forTable(0) .withSelector(DefaultTrafficSelector.builder() .extension(extSelector, myDeviceId) .build()) .withTreatment(DefaultTrafficTreatment.builder() .extension(extTreatment, myDeviceId) .build()) .build(); |
...
- https://github.com/ccascone/onos-p4-dev
- ONOS fork of BMv2
- Sample P4 programs
bmv2.py Mininet script
- Command samples Sample commands to run a network of bmv2 devices connected to ONOS
- Usage with onos.py
BMv2 Device Context Service API
...