alshabib

adding rules for radius forwarding.

Change-Id: Ic3aee107a1802766c5c80adaf0c58dda7fab632c
...@@ -74,6 +74,8 @@ public class CordFabricManager implements FabricService { ...@@ -74,6 +74,8 @@ public class CordFabricManager implements FabricService {
74 74
75 private short openflowPort = 6633; 75 private short openflowPort = 6633;
76 76
77 + private short radiusPort = 1812;
78 +
77 private DeviceId fabricDeviceId = DeviceId.deviceId("of:5e3e486e73000187"); 79 private DeviceId fabricDeviceId = DeviceId.deviceId("of:5e3e486e73000187");
78 80
79 private ConnectPoint oltConnectPoint = 81 private ConnectPoint oltConnectPoint =
...@@ -98,18 +100,33 @@ public class CordFabricManager implements FabricService { ...@@ -98,18 +100,33 @@ public class CordFabricManager implements FabricService {
98 } 100 }
99 101
100 private void setupDefaultFlows() { 102 private void setupDefaultFlows() {
101 - TrafficSelector toControllerS = DefaultTrafficSelector.builder() 103 + TrafficSelector toControllerOF = DefaultTrafficSelector.builder()
102 .matchEthType(Ethernet.TYPE_IPV4) 104 .matchEthType(Ethernet.TYPE_IPV4)
103 .matchIPProtocol(IPv4.PROTOCOL_TCP) 105 .matchIPProtocol(IPv4.PROTOCOL_TCP)
104 .matchTcpDst(openflowPort) 106 .matchTcpDst(openflowPort)
105 .build(); 107 .build();
106 108
107 - TrafficSelector fromControllerS = DefaultTrafficSelector.builder() 109 + TrafficSelector fromControllerOF = DefaultTrafficSelector.builder()
108 .matchEthType(Ethernet.TYPE_IPV4) 110 .matchEthType(Ethernet.TYPE_IPV4)
109 .matchIPProtocol(IPv4.PROTOCOL_TCP) 111 .matchIPProtocol(IPv4.PROTOCOL_TCP)
110 .matchTcpSrc(openflowPort) 112 .matchTcpSrc(openflowPort)
111 .build(); 113 .build();
112 114
115 + TrafficSelector toControllerRadius = DefaultTrafficSelector.builder()
116 + .matchEthType(Ethernet.TYPE_IPV4)
117 + .matchInPort(oltConnectPoint.port())
118 + .matchIPProtocol(IPv4.PROTOCOL_UDP)
119 + .matchUdpDst(radiusPort)
120 + .build();
121 +
122 + TrafficSelector fromControllerRadius = DefaultTrafficSelector.builder()
123 + .matchEthType(Ethernet.TYPE_IPV4)
124 + .matchInPort(oltControllerConnectPoint.port())
125 + .matchIPProtocol(IPv4.PROTOCOL_UDP)
126 + .matchUdpDst(radiusPort)
127 + .build();
128 +
129 +
113 TrafficTreatment forwardToController = DefaultTrafficTreatment.builder() 130 TrafficTreatment forwardToController = DefaultTrafficTreatment.builder()
114 .setOutput(oltControllerConnectPoint.port()) 131 .setOutput(oltControllerConnectPoint.port())
115 .build(); 132 .build();
...@@ -123,7 +140,7 @@ public class CordFabricManager implements FabricService { ...@@ -123,7 +140,7 @@ public class CordFabricManager implements FabricService {
123 .makePermanent() 140 .makePermanent()
124 .withFlag(ForwardingObjective.Flag.VERSATILE) 141 .withFlag(ForwardingObjective.Flag.VERSATILE)
125 .withPriority(PRIORITY) 142 .withPriority(PRIORITY)
126 - .withSelector(toControllerS) 143 + .withSelector(toControllerOF)
127 .withTreatment(forwardToController) 144 .withTreatment(forwardToController)
128 .add(); 145 .add();
129 146
...@@ -132,12 +149,32 @@ public class CordFabricManager implements FabricService { ...@@ -132,12 +149,32 @@ public class CordFabricManager implements FabricService {
132 .makePermanent() 149 .makePermanent()
133 .withFlag(ForwardingObjective.Flag.VERSATILE) 150 .withFlag(ForwardingObjective.Flag.VERSATILE)
134 .withPriority(PRIORITY) 151 .withPriority(PRIORITY)
135 - .withSelector(fromControllerS) 152 + .withSelector(fromControllerOF)
153 + .withTreatment(forwardFromController)
154 + .add();
155 +
156 + ForwardingObjective radiusToController = DefaultForwardingObjective.builder()
157 + .fromApp(appId)
158 + .makePermanent()
159 + .withFlag(ForwardingObjective.Flag.VERSATILE)
160 + .withPriority(PRIORITY)
161 + .withSelector(toControllerRadius)
162 + .withTreatment(forwardToController)
163 + .add();
164 +
165 + ForwardingObjective radiusFromController = DefaultForwardingObjective.builder()
166 + .fromApp(appId)
167 + .makePermanent()
168 + .withFlag(ForwardingObjective.Flag.VERSATILE)
169 + .withPriority(PRIORITY)
170 + .withSelector(fromControllerRadius)
136 .withTreatment(forwardFromController) 171 .withTreatment(forwardFromController)
137 .add(); 172 .add();
138 173
139 flowObjectiveService.forward(fabricDeviceId, ofToController); 174 flowObjectiveService.forward(fabricDeviceId, ofToController);
140 flowObjectiveService.forward(fabricDeviceId, ofFromController); 175 flowObjectiveService.forward(fabricDeviceId, ofFromController);
176 + flowObjectiveService.forward(fabricDeviceId, radiusToController);
177 + flowObjectiveService.forward(fabricDeviceId, radiusFromController);
141 } 178 }
142 179
143 @Override 180 @Override
......