Committed by
Gerrit Code Review
adding iptv provisioning
Change-Id: I11fcc788402793d0bf3ac9d9f03ed77e093d98ad
Showing
6 changed files
with
70 additions
and
37 deletions
... | @@ -168,6 +168,8 @@ public class CordFabricManager implements FabricService { | ... | @@ -168,6 +168,8 @@ public class CordFabricManager implements FabricService { |
168 | .withTreatment(down) | 168 | .withTreatment(down) |
169 | .add(); | 169 | .add(); |
170 | 170 | ||
171 | + | ||
172 | + | ||
171 | flowObjectiveService.forward(fabricDeviceId, upCtrl); | 173 | flowObjectiveService.forward(fabricDeviceId, upCtrl); |
172 | flowObjectiveService.forward(fabricDeviceId, downCtrl); | 174 | flowObjectiveService.forward(fabricDeviceId, downCtrl); |
173 | flowObjectiveService.forward(fabricDeviceId, radiusToController); | 175 | flowObjectiveService.forward(fabricDeviceId, radiusToController); |
... | @@ -181,6 +183,10 @@ public class CordFabricManager implements FabricService { | ... | @@ -181,6 +183,10 @@ public class CordFabricManager implements FabricService { |
181 | 183 | ||
182 | removeVlan(vlan.vlan()); | 184 | removeVlan(vlan.vlan()); |
183 | 185 | ||
186 | + if (vlan.iptv()) { | ||
187 | + provisionIPTV(); | ||
188 | + } | ||
189 | + | ||
184 | vlan.ports().forEach(cp -> { | 190 | vlan.ports().forEach(cp -> { |
185 | if (vlans.put(vlan.vlan(), cp)) { | 191 | if (vlans.put(vlan.vlan(), cp)) { |
186 | addForwarding(vlan.vlan(), cp.deviceId(), cp.port(), | 192 | addForwarding(vlan.vlan(), cp.deviceId(), cp.port(), |
... | @@ -192,6 +198,46 @@ public class CordFabricManager implements FabricService { | ... | @@ -192,6 +198,46 @@ public class CordFabricManager implements FabricService { |
192 | }); | 198 | }); |
193 | } | 199 | } |
194 | 200 | ||
201 | + //FIXME: pass iptv vlan in here. | ||
202 | + private void provisionIPTV() { | ||
203 | + TrafficSelector ipTvUp = DefaultTrafficSelector.builder() | ||
204 | + .matchVlanId(VlanId.vlanId((short) 7)) | ||
205 | + .matchInPort(PortNumber.portNumber(2)) | ||
206 | + .build(); | ||
207 | + | ||
208 | + TrafficTreatment ipTvActUp = DefaultTrafficTreatment.builder() | ||
209 | + .setOutput(PortNumber.portNumber(7)).build(); | ||
210 | + | ||
211 | + TrafficSelector ipTvDown = DefaultTrafficSelector.builder() | ||
212 | + .matchVlanId(VlanId.vlanId((short) 7)) | ||
213 | + .matchInPort(PortNumber.portNumber(7)) | ||
214 | + .build(); | ||
215 | + | ||
216 | + TrafficTreatment ipTvActDown = DefaultTrafficTreatment.builder() | ||
217 | + .setOutput(PortNumber.portNumber(2)).build(); | ||
218 | + | ||
219 | + ForwardingObjective ipTvUpstream = DefaultForwardingObjective.builder() | ||
220 | + .fromApp(appId) | ||
221 | + .makePermanent() | ||
222 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
223 | + .withPriority(PRIORITY) | ||
224 | + .withSelector(ipTvUp) | ||
225 | + .withTreatment(ipTvActUp) | ||
226 | + .add(); | ||
227 | + | ||
228 | + ForwardingObjective ipTvDownstream = DefaultForwardingObjective.builder() | ||
229 | + .fromApp(appId) | ||
230 | + .makePermanent() | ||
231 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
232 | + .withPriority(PRIORITY) | ||
233 | + .withSelector(ipTvDown) | ||
234 | + .withTreatment(ipTvActDown) | ||
235 | + .add(); | ||
236 | + | ||
237 | + flowObjectiveService.forward(fabricDeviceId, ipTvUpstream); | ||
238 | + flowObjectiveService.forward(fabricDeviceId, ipTvDownstream); | ||
239 | + } | ||
240 | + | ||
195 | @Override | 241 | @Override |
196 | public void removeVlan(VlanId vlanId) { | 242 | public void removeVlan(VlanId vlanId) { |
197 | vlans.removeAll(vlanId) | 243 | vlans.removeAll(vlanId) |
... | @@ -202,7 +248,9 @@ public class CordFabricManager implements FabricService { | ... | @@ -202,7 +248,9 @@ public class CordFabricManager implements FabricService { |
202 | public List<FabricVlan> getVlans() { | 248 | public List<FabricVlan> getVlans() { |
203 | List<FabricVlan> fVlans = new ArrayList<>(); | 249 | List<FabricVlan> fVlans = new ArrayList<>(); |
204 | vlans.keySet().forEach(vlan -> fVlans.add( | 250 | vlans.keySet().forEach(vlan -> fVlans.add( |
205 | - new FabricVlan(vlan, vlans.get(vlan)))); | 251 | + //FIXME: Very aweful but will fo for now |
252 | + new FabricVlan(vlan, vlans.get(vlan), | ||
253 | + vlan.toShort() == 201 ? true : false))); | ||
206 | return fVlans; | 254 | return fVlans; |
207 | } | 255 | } |
208 | 256 | ||
... | @@ -217,6 +265,7 @@ public class CordFabricManager implements FabricService { | ... | @@ -217,6 +265,7 @@ public class CordFabricManager implements FabricService { |
217 | 265 | ||
218 | private void addForwarding(VlanId vlanId, DeviceId deviceId, PortNumber inPort, | 266 | private void addForwarding(VlanId vlanId, DeviceId deviceId, PortNumber inPort, |
219 | List<PortNumber> outPorts) { | 267 | List<PortNumber> outPorts) { |
268 | + | ||
220 | TrafficSelector selector = DefaultTrafficSelector.builder() | 269 | TrafficSelector selector = DefaultTrafficSelector.builder() |
221 | .matchVlanId(vlanId) | 270 | .matchVlanId(vlanId) |
222 | .matchInPort(inPort) | 271 | .matchInPort(inPort) | ... | ... |
... | @@ -33,12 +33,14 @@ public class FabricVlan { | ... | @@ -33,12 +33,14 @@ public class FabricVlan { |
33 | private final VlanId vlan; | 33 | private final VlanId vlan; |
34 | 34 | ||
35 | private final List<ConnectPoint> ports; | 35 | private final List<ConnectPoint> ports; |
36 | + private final boolean iptv; | ||
36 | 37 | ||
37 | - public FabricVlan(VlanId vlan, Collection<ConnectPoint> ports) { | 38 | + public FabricVlan(VlanId vlan, Collection<ConnectPoint> ports, boolean iptv) { |
38 | checkNotNull(vlan); | 39 | checkNotNull(vlan); |
39 | checkNotNull(ports); | 40 | checkNotNull(ports); |
40 | this.vlan = vlan; | 41 | this.vlan = vlan; |
41 | this.ports = ImmutableList.copyOf(ports); | 42 | this.ports = ImmutableList.copyOf(ports); |
43 | + this.iptv = iptv; | ||
42 | } | 44 | } |
43 | 45 | ||
44 | public VlanId vlan() { | 46 | public VlanId vlan() { |
... | @@ -48,4 +50,8 @@ public class FabricVlan { | ... | @@ -48,4 +50,8 @@ public class FabricVlan { |
48 | public List<ConnectPoint> ports() { | 50 | public List<ConnectPoint> ports() { |
49 | return ports; | 51 | return ports; |
50 | } | 52 | } |
53 | + | ||
54 | + public boolean iptv() { | ||
55 | + return iptv; | ||
56 | + } | ||
51 | } | 57 | } | ... | ... |
... | @@ -37,6 +37,7 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { | ... | @@ -37,6 +37,7 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { |
37 | // JSON field names | 37 | // JSON field names |
38 | private static final String VLAN = "vlan"; | 38 | private static final String VLAN = "vlan"; |
39 | private static final String PORTS = "ports"; | 39 | private static final String PORTS = "ports"; |
40 | + private static final String IPTV = "iptv"; | ||
40 | 41 | ||
41 | @Override | 42 | @Override |
42 | public ObjectNode encode(FabricVlan vlan, CodecContext context) { | 43 | public ObjectNode encode(FabricVlan vlan, CodecContext context) { |
... | @@ -54,6 +55,7 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { | ... | @@ -54,6 +55,7 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { |
54 | @Override | 55 | @Override |
55 | public FabricVlan decode(ObjectNode json, CodecContext context) { | 56 | public FabricVlan decode(ObjectNode json, CodecContext context) { |
56 | short vlan = json.path(VLAN).shortValue(); | 57 | short vlan = json.path(VLAN).shortValue(); |
58 | + boolean iptv = json.path(IPTV).booleanValue(); | ||
57 | List<ConnectPoint> ports = new ArrayList<>(); | 59 | List<ConnectPoint> ports = new ArrayList<>(); |
58 | 60 | ||
59 | ArrayNode portArray = (ArrayNode) json.path(PORTS); | 61 | ArrayNode portArray = (ArrayNode) json.path(PORTS); |
... | @@ -61,6 +63,6 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { | ... | @@ -61,6 +63,6 @@ public final class FabricVlanCodec extends JsonCodec<FabricVlan> { |
61 | ports.add(context.codec(ConnectPoint.class).decode((ObjectNode) o, context)); | 63 | ports.add(context.codec(ConnectPoint.class).decode((ObjectNode) o, context)); |
62 | } | 64 | } |
63 | 65 | ||
64 | - return new FabricVlan(VlanId.vlanId(vlan), ports); | 66 | + return new FabricVlan(VlanId.vlanId(vlan), ports, iptv); |
65 | } | 67 | } |
66 | } | 68 | } | ... | ... |
... | @@ -59,6 +59,6 @@ public class FabricAddCommand extends AbstractShellCommand { | ... | @@ -59,6 +59,6 @@ public class FabricAddCommand extends AbstractShellCommand { |
59 | ports.add(ConnectPoint.deviceConnectPoint(portString)); | 59 | ports.add(ConnectPoint.deviceConnectPoint(portString)); |
60 | } | 60 | } |
61 | 61 | ||
62 | - service.addVlan(new FabricVlan(vlan, ports)); | 62 | + service.addVlan(new FabricVlan(vlan, ports, false)); |
63 | } | 63 | } |
64 | } | 64 | } | ... | ... |
... | @@ -415,8 +415,16 @@ public class OnosXOSIntegrationManager implements VoltTenantService { | ... | @@ -415,8 +415,16 @@ public class OnosXOSIntegrationManager implements VoltTenantService { |
415 | // + FABRIC_VCPE_CONNECT_POINT.toString() + "\"}"; | 415 | // + FABRIC_VCPE_CONNECT_POINT.toString() + "\"}"; |
416 | //json += "]}"; | 416 | //json += "]}"; |
417 | 417 | ||
418 | + long vlan = portToVlan.get(fromPoint.port().toLong()); | ||
419 | + | ||
420 | + | ||
418 | JsonObject node = new JsonObject(); | 421 | JsonObject node = new JsonObject(); |
419 | - node.add("vlan", portToVlan.get(fromPoint.port().toLong())); | 422 | + node.add("vlan", vlan); |
423 | + if (vlan == 201) { | ||
424 | + node.add("iptv", true); | ||
425 | + } else { | ||
426 | + node.add("iptv", false); | ||
427 | + } | ||
420 | JsonArray array = new JsonArray(); | 428 | JsonArray array = new JsonArray(); |
421 | JsonObject cp1 = new JsonObject(); | 429 | JsonObject cp1 = new JsonObject(); |
422 | JsonObject cp2 = new JsonObject(); | 430 | JsonObject cp2 = new JsonObject(); | ... | ... |
... | @@ -16,15 +16,12 @@ | ... | @@ -16,15 +16,12 @@ |
16 | package org.onosproject.driver.pipeline; | 16 | package org.onosproject.driver.pipeline; |
17 | 17 | ||
18 | import org.onlab.osgi.ServiceDirectory; | 18 | import org.onlab.osgi.ServiceDirectory; |
19 | -import org.onlab.packet.Ethernet; | ||
20 | -import org.onosproject.core.ApplicationId; | ||
21 | import org.onosproject.net.DeviceId; | 19 | import org.onosproject.net.DeviceId; |
22 | import org.onosproject.net.PortNumber; | 20 | import org.onosproject.net.PortNumber; |
23 | import org.onosproject.net.behaviour.Pipeliner; | 21 | import org.onosproject.net.behaviour.Pipeliner; |
24 | import org.onosproject.net.behaviour.PipelinerContext; | 22 | import org.onosproject.net.behaviour.PipelinerContext; |
25 | import org.onosproject.net.driver.AbstractHandlerBehaviour; | 23 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
26 | import org.onosproject.net.flow.DefaultFlowRule; | 24 | import org.onosproject.net.flow.DefaultFlowRule; |
27 | -import org.onosproject.net.flow.DefaultTrafficSelector; | ||
28 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 25 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
29 | import org.onosproject.net.flow.FlowRule; | 26 | import org.onosproject.net.flow.FlowRule; |
30 | import org.onosproject.net.flow.FlowRuleOperations; | 27 | import org.onosproject.net.flow.FlowRuleOperations; |
... | @@ -52,7 +49,6 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -52,7 +49,6 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
52 | private FlowRuleService flowRuleService; | 49 | private FlowRuleService flowRuleService; |
53 | private DeviceId deviceId; | 50 | private DeviceId deviceId; |
54 | 51 | ||
55 | - private boolean done = false; | ||
56 | 52 | ||
57 | @Override | 53 | @Override |
58 | public void init(DeviceId deviceId, PipelinerContext context) { | 54 | public void init(DeviceId deviceId, PipelinerContext context) { |
... | @@ -63,34 +59,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -63,34 +59,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
63 | 59 | ||
64 | } | 60 | } |
65 | 61 | ||
66 | - private boolean installIGMPRule(ApplicationId appId, boolean done) { | ||
67 | - if (done) { | ||
68 | - return done; | ||
69 | - } | ||
70 | - TrafficSelector selector = DefaultTrafficSelector.builder() | ||
71 | - .matchInPort(PortNumber.portNumber(1)) | ||
72 | - .matchEthType(Ethernet.TYPE_IPV4) | ||
73 | - .matchIPProtocol((byte) 2).build(); | ||
74 | - | ||
75 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder() | ||
76 | - .punt().build(); | ||
77 | - | ||
78 | - FlowRule rule = DefaultFlowRule.builder() | ||
79 | - .forDevice(deviceId) | ||
80 | - .fromApp(appId) | ||
81 | - .withTreatment(treatment) | ||
82 | - .withSelector(selector) | ||
83 | - .makePermanent() | ||
84 | - .withPriority(0) | ||
85 | - .build(); | ||
86 | 62 | ||
87 | - FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder(); | ||
88 | - | ||
89 | - flowRuleService.apply(flowBuilder.add(rule).build()); | ||
90 | - | ||
91 | - return true; | ||
92 | - | ||
93 | - } | ||
94 | 63 | ||
95 | @Override | 64 | @Override |
96 | public void filter(FilteringObjective filter) { | 65 | public void filter(FilteringObjective filter) { |
... | @@ -99,7 +68,6 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -99,7 +68,6 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
99 | 68 | ||
100 | @Override | 69 | @Override |
101 | public void forward(ForwardingObjective fwd) { | 70 | public void forward(ForwardingObjective fwd) { |
102 | - done = installIGMPRule(fwd.appId(), done); | ||
103 | FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder(); | 71 | FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder(); |
104 | 72 | ||
105 | if (fwd.flag() != ForwardingObjective.Flag.VERSATILE) { | 73 | if (fwd.flag() != ForwardingObjective.Flag.VERSATILE) { | ... | ... |
-
Please register or login to post a comment