adding inband of ctrl
Change-Id: I9dc389770cb18428d6830ec533452d23c7243768
Showing
1 changed file
with
50 additions
and
6 deletions
| ... | @@ -82,6 +82,8 @@ public class CordFabricManager implements FabricService { | ... | @@ -82,6 +82,8 @@ public class CordFabricManager implements FabricService { |
| 82 | 82 | ||
| 83 | private short radiusPort = 1812; | 83 | private short radiusPort = 1812; |
| 84 | 84 | ||
| 85 | + private short ofPort = 6633; | ||
| 86 | + | ||
| 85 | private DeviceId fabricDeviceId = DeviceId.deviceId("of:5e3e486e73000187"); | 87 | private DeviceId fabricDeviceId = DeviceId.deviceId("of:5e3e486e73000187"); |
| 86 | 88 | ||
| 87 | private final Multimap<VlanId, ConnectPoint> vlans = HashMultimap.create(); | 89 | private final Multimap<VlanId, ConnectPoint> vlans = HashMultimap.create(); |
| ... | @@ -107,26 +109,68 @@ public class CordFabricManager implements FabricService { | ... | @@ -107,26 +109,68 @@ public class CordFabricManager implements FabricService { |
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | private void setupDefaultFlows() { | 111 | private void setupDefaultFlows() { |
| 110 | - TrafficSelector toControllerOF = DefaultTrafficSelector.builder() | 112 | + TrafficSelector ofInBandMatchUp = DefaultTrafficSelector.builder() |
| 113 | + .matchEthType(Ethernet.TYPE_IPV4) | ||
| 114 | + .matchIPProtocol(IPv4.PROTOCOL_TCP) | ||
| 115 | + .matchTcpDst(ofPort) | ||
| 116 | + .matchInPort(PortNumber.portNumber(6)) | ||
| 117 | + .build(); | ||
| 118 | + | ||
| 119 | + TrafficSelector ofInBandMatchDown = DefaultTrafficSelector.builder() | ||
| 120 | + .matchEthType(Ethernet.TYPE_IPV4) | ||
| 121 | + .matchIPProtocol(IPv4.PROTOCOL_TCP) | ||
| 122 | + .matchTcpSrc(ofPort) | ||
| 123 | + .matchInPort(PortNumber.portNumber(5)) | ||
| 124 | + .build(); | ||
| 125 | + | ||
| 126 | + TrafficTreatment up = DefaultTrafficTreatment.builder() | ||
| 127 | + .setOutput(PortNumber.portNumber(5)) | ||
| 128 | + .build(); | ||
| 129 | + | ||
| 130 | + TrafficTreatment down = DefaultTrafficTreatment.builder() | ||
| 131 | + .setOutput(PortNumber.portNumber(6)) | ||
| 132 | + .build(); | ||
| 133 | + | ||
| 134 | + TrafficSelector toRadius = DefaultTrafficSelector.builder() | ||
| 111 | .matchEthType(Ethernet.TYPE_IPV4) | 135 | .matchEthType(Ethernet.TYPE_IPV4) |
| 112 | .matchIPProtocol(IPv4.PROTOCOL_UDP) | 136 | .matchIPProtocol(IPv4.PROTOCOL_UDP) |
| 113 | .matchUdpDst(radiusPort) | 137 | .matchUdpDst(radiusPort) |
| 114 | .build(); | 138 | .build(); |
| 115 | 139 | ||
| 116 | - TrafficTreatment forwardToController = DefaultTrafficTreatment.builder() | 140 | + TrafficTreatment puntToController = DefaultTrafficTreatment.builder() |
| 117 | .punt() | 141 | .punt() |
| 118 | .build(); | 142 | .build(); |
| 119 | 143 | ||
| 120 | - ForwardingObjective ofToController = DefaultForwardingObjective.builder() | 144 | + ForwardingObjective radiusToController = DefaultForwardingObjective.builder() |
| 145 | + .fromApp(appId) | ||
| 146 | + .makePermanent() | ||
| 147 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
| 148 | + .withPriority(PRIORITY) | ||
| 149 | + .withSelector(toRadius) | ||
| 150 | + .withTreatment(puntToController) | ||
| 151 | + .add(); | ||
| 152 | + | ||
| 153 | + ForwardingObjective upCtrl = DefaultForwardingObjective.builder() | ||
| 154 | + .fromApp(appId) | ||
| 155 | + .makePermanent() | ||
| 156 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
| 157 | + .withPriority(PRIORITY) | ||
| 158 | + .withSelector(ofInBandMatchUp) | ||
| 159 | + .withTreatment(up) | ||
| 160 | + .add(); | ||
| 161 | + | ||
| 162 | + ForwardingObjective downCtrl = DefaultForwardingObjective.builder() | ||
| 121 | .fromApp(appId) | 163 | .fromApp(appId) |
| 122 | .makePermanent() | 164 | .makePermanent() |
| 123 | .withFlag(ForwardingObjective.Flag.VERSATILE) | 165 | .withFlag(ForwardingObjective.Flag.VERSATILE) |
| 124 | .withPriority(PRIORITY) | 166 | .withPriority(PRIORITY) |
| 125 | - .withSelector(toControllerOF) | 167 | + .withSelector(ofInBandMatchDown) |
| 126 | - .withTreatment(forwardToController) | 168 | + .withTreatment(down) |
| 127 | .add(); | 169 | .add(); |
| 128 | 170 | ||
| 129 | - flowObjectiveService.forward(fabricDeviceId, ofToController); | 171 | + flowObjectiveService.forward(fabricDeviceId, upCtrl); |
| 172 | + flowObjectiveService.forward(fabricDeviceId, downCtrl); | ||
| 173 | + flowObjectiveService.forward(fabricDeviceId, radiusToController); | ||
| 130 | } | 174 | } |
| 131 | 175 | ||
| 132 | @Override | 176 | @Override | ... | ... |
-
Please register or login to post a comment