Committed by
Gerrit Code Review
[Emu] ODU SIGID and SIGTYPE FlowEntryBuilder and FlowModBuilder implementations
Change-Id: I6b332f98dd74250d1cdb289a00780d0d16ae7fb2
Showing
7 changed files
with
179 additions
and
5 deletions
... | @@ -74,7 +74,7 @@ public final class OduSignalIdCriterion implements Criterion { | ... | @@ -74,7 +74,7 @@ public final class OduSignalIdCriterion implements Criterion { |
74 | 74 | ||
75 | @Override | 75 | @Override |
76 | public String toString() { | 76 | public String toString() { |
77 | - return toStringHelper(type().toString()) | 77 | + return toStringHelper(this) |
78 | .add("oduSignalId", oduSignalId) | 78 | .add("oduSignalId", oduSignalId) |
79 | .toString(); | 79 | .toString(); |
80 | } | 80 | } | ... | ... |
... | @@ -74,7 +74,7 @@ public final class OduSignalTypeCriterion implements Criterion { | ... | @@ -74,7 +74,7 @@ public final class OduSignalTypeCriterion implements Criterion { |
74 | 74 | ||
75 | @Override | 75 | @Override |
76 | public String toString() { | 76 | public String toString() { |
77 | - return toStringHelper(type().toString()) | 77 | + return toStringHelper(this) |
78 | .add("signalType", signalType) | 78 | .add("signalType", signalType) |
79 | .toString(); | 79 | .toString(); |
80 | } | 80 | } | ... | ... |
... | @@ -27,6 +27,7 @@ import org.onlab.packet.VlanId; | ... | @@ -27,6 +27,7 @@ import org.onlab.packet.VlanId; |
27 | import org.onosproject.core.DefaultGroupId; | 27 | import org.onosproject.core.DefaultGroupId; |
28 | import org.onosproject.net.DeviceId; | 28 | import org.onosproject.net.DeviceId; |
29 | import org.onosproject.net.Lambda; | 29 | import org.onosproject.net.Lambda; |
30 | +import org.onosproject.net.OduSignalId; | ||
30 | import org.onosproject.net.PortNumber; | 31 | import org.onosproject.net.PortNumber; |
31 | import org.onosproject.net.driver.DefaultDriverData; | 32 | import org.onosproject.net.driver.DefaultDriverData; |
32 | import org.onosproject.net.driver.DefaultDriverHandler; | 33 | import org.onosproject.net.driver.DefaultDriverHandler; |
... | @@ -83,15 +84,21 @@ import org.projectfloodlight.openflow.types.U32; | ... | @@ -83,15 +84,21 @@ import org.projectfloodlight.openflow.types.U32; |
83 | import org.projectfloodlight.openflow.types.U64; | 84 | import org.projectfloodlight.openflow.types.U64; |
84 | import org.projectfloodlight.openflow.types.U8; | 85 | import org.projectfloodlight.openflow.types.U8; |
85 | import org.projectfloodlight.openflow.types.VlanPcp; | 86 | import org.projectfloodlight.openflow.types.VlanPcp; |
87 | +import org.projectfloodlight.openflow.types.OduSignalID; | ||
86 | import org.slf4j.Logger; | 88 | import org.slf4j.Logger; |
87 | 89 | ||
88 | import java.util.List; | 90 | import java.util.List; |
89 | 91 | ||
90 | import static org.onosproject.net.flow.criteria.Criteria.matchLambda; | 92 | import static org.onosproject.net.flow.criteria.Criteria.matchLambda; |
91 | import static org.onosproject.net.flow.criteria.Criteria.matchOchSignalType; | 93 | import static org.onosproject.net.flow.criteria.Criteria.matchOchSignalType; |
94 | +import static org.onosproject.net.flow.criteria.Criteria.matchOduSignalType; | ||
95 | +import static org.onosproject.net.flow.criteria.Criteria.matchOduSignalId; | ||
96 | +import static org.onosproject.net.flow.instructions.Instructions.modL0Lambda; | ||
97 | +import static org.onosproject.net.flow.instructions.Instructions.modL1OduSignalId; | ||
92 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupChannelSpacing; | 98 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupChannelSpacing; |
93 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupGridType; | 99 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupGridType; |
94 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOchSignalType; | 100 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOchSignalType; |
101 | +import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOduSignalType; | ||
95 | import static org.slf4j.LoggerFactory.getLogger; | 102 | import static org.slf4j.LoggerFactory.getLogger; |
96 | 103 | ||
97 | public class FlowEntryBuilder { | 104 | public class FlowEntryBuilder { |
... | @@ -454,6 +461,29 @@ public class FlowEntryBuilder { | ... | @@ -454,6 +461,29 @@ public class FlowEntryBuilder { |
454 | builder.extension(interpreter.mapAction(action), DeviceId.deviceId(Dpid.uri(dpid))); | 461 | builder.extension(interpreter.mapAction(action), DeviceId.deviceId(Dpid.uri(dpid))); |
455 | } | 462 | } |
456 | break; | 463 | break; |
464 | + case EXP_ODU_SIG_ID: | ||
465 | + @SuppressWarnings("unchecked") | ||
466 | + OFOxm<OduSignalID> oduID = (OFOxm<OduSignalID>) oxm; | ||
467 | + OduSignalID oduSignalID = oduID.getValue(); | ||
468 | + OduSignalId oduSignalId = OduSignalId.oduSignalId(oduSignalID.getTpn(), | ||
469 | + oduSignalID.getTslen(), | ||
470 | + oduSignalID.getTsmap()); | ||
471 | + builder.add(modL1OduSignalId(oduSignalId)); | ||
472 | + break; | ||
473 | + case EXP_OCH_SIG_ID: | ||
474 | + try { | ||
475 | + @SuppressWarnings("unchecked") | ||
476 | + OFOxm<CircuitSignalID> ochId = (OFOxm<CircuitSignalID>) oxm; | ||
477 | + CircuitSignalID circuitSignalID = ochId.getValue(); | ||
478 | + builder.add(modL0Lambda(Lambda.ochSignal( | ||
479 | + lookupGridType(circuitSignalID.getGridType()), | ||
480 | + lookupChannelSpacing(circuitSignalID.getChannelSpacing()), | ||
481 | + circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth()))); | ||
482 | + } catch (NoMappingFoundException e) { | ||
483 | + log.warn(e.getMessage()); | ||
484 | + break; | ||
485 | + } | ||
486 | + break; | ||
457 | case ARP_OP: | 487 | case ARP_OP: |
458 | case ARP_SHA: | 488 | case ARP_SHA: |
459 | case ARP_SPA: | 489 | case ARP_SPA: |
... | @@ -501,6 +531,8 @@ public class FlowEntryBuilder { | ... | @@ -501,6 +531,8 @@ public class FlowEntryBuilder { |
501 | case OCH_SIGTYPE_BASIC: | 531 | case OCH_SIGTYPE_BASIC: |
502 | case SCTP_DST: | 532 | case SCTP_DST: |
503 | case SCTP_SRC: | 533 | case SCTP_SRC: |
534 | + case EXP_ODU_SIGTYPE: | ||
535 | + case EXP_OCH_SIGTYPE: | ||
504 | default: | 536 | default: |
505 | log.warn("Set field type {} not yet implemented.", oxm.getMatchField().id); | 537 | log.warn("Set field type {} not yet implemented.", oxm.getMatchField().id); |
506 | break; | 538 | break; |
... | @@ -704,6 +736,41 @@ public class FlowEntryBuilder { | ... | @@ -704,6 +736,41 @@ public class FlowEntryBuilder { |
704 | U8 sigType = match.get(MatchField.OCH_SIGTYPE); | 736 | U8 sigType = match.get(MatchField.OCH_SIGTYPE); |
705 | builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue()))); | 737 | builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue()))); |
706 | break; | 738 | break; |
739 | + case EXP_OCH_SIG_ID: | ||
740 | + try { | ||
741 | + CircuitSignalID expSigId = match.get(MatchField.EXP_OCH_SIG_ID); | ||
742 | + builder.add(matchLambda(Lambda.ochSignal( | ||
743 | + lookupGridType(expSigId.getGridType()), lookupChannelSpacing(expSigId.getChannelSpacing()), | ||
744 | + expSigId.getChannelNumber(), expSigId.getSpectralWidth()))); | ||
745 | + } catch (NoMappingFoundException e) { | ||
746 | + log.warn(e.getMessage()); | ||
747 | + break; | ||
748 | + } | ||
749 | + break; | ||
750 | + case EXP_OCH_SIGTYPE: | ||
751 | + try { | ||
752 | + U8 expOchSigType = match.get(MatchField.EXP_OCH_SIGTYPE); | ||
753 | + builder.add(matchOchSignalType(lookupOchSignalType((byte) expOchSigType.getValue()))); | ||
754 | + } catch (NoMappingFoundException e) { | ||
755 | + log.warn(e.getMessage()); | ||
756 | + break; | ||
757 | + } | ||
758 | + break; | ||
759 | + case EXP_ODU_SIG_ID: | ||
760 | + OduSignalId oduSignalId = OduSignalId.oduSignalId(match.get(MatchField.EXP_ODU_SIG_ID).getTpn(), | ||
761 | + match.get(MatchField.EXP_ODU_SIG_ID).getTslen(), | ||
762 | + match.get(MatchField.EXP_ODU_SIG_ID).getTsmap()); | ||
763 | + builder.add(matchOduSignalId(oduSignalId)); | ||
764 | + break; | ||
765 | + case EXP_ODU_SIGTYPE: | ||
766 | + try { | ||
767 | + U8 oduSigType = match.get(MatchField.EXP_ODU_SIGTYPE); | ||
768 | + builder.add(matchOduSignalType(lookupOduSignalType((byte) oduSigType.getValue()))); | ||
769 | + } catch (NoMappingFoundException e) { | ||
770 | + log.warn(e.getMessage()); | ||
771 | + break; | ||
772 | + } | ||
773 | + break; | ||
707 | case TUNNEL_ID: | 774 | case TUNNEL_ID: |
708 | long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); | 775 | long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); |
709 | builder.matchTunnelId(tunnelId); | 776 | builder.matchTunnelId(tunnelId); | ... | ... |
... | @@ -26,6 +26,7 @@ import org.onosproject.net.driver.DefaultDriverData; | ... | @@ -26,6 +26,7 @@ import org.onosproject.net.driver.DefaultDriverData; |
26 | import org.onosproject.net.driver.DefaultDriverHandler; | 26 | import org.onosproject.net.driver.DefaultDriverHandler; |
27 | import org.onosproject.net.driver.Driver; | 27 | import org.onosproject.net.driver.Driver; |
28 | import org.onosproject.net.driver.DriverService; | 28 | import org.onosproject.net.driver.DriverService; |
29 | +import org.onosproject.net.OduSignalId; | ||
29 | import org.onosproject.net.flow.FlowRule; | 30 | import org.onosproject.net.flow.FlowRule; |
30 | import org.onosproject.net.flow.TrafficSelector; | 31 | import org.onosproject.net.flow.TrafficSelector; |
31 | import org.onosproject.net.flow.criteria.ArpHaCriterion; | 32 | import org.onosproject.net.flow.criteria.ArpHaCriterion; |
... | @@ -53,6 +54,8 @@ import org.onosproject.net.flow.criteria.MplsBosCriterion; | ... | @@ -53,6 +54,8 @@ import org.onosproject.net.flow.criteria.MplsBosCriterion; |
53 | import org.onosproject.net.flow.criteria.MplsCriterion; | 54 | import org.onosproject.net.flow.criteria.MplsCriterion; |
54 | import org.onosproject.net.flow.criteria.OchSignalCriterion; | 55 | import org.onosproject.net.flow.criteria.OchSignalCriterion; |
55 | import org.onosproject.net.flow.criteria.OchSignalTypeCriterion; | 56 | import org.onosproject.net.flow.criteria.OchSignalTypeCriterion; |
57 | +import org.onosproject.net.flow.criteria.OduSignalIdCriterion; | ||
58 | +import org.onosproject.net.flow.criteria.OduSignalTypeCriterion; | ||
56 | import org.onosproject.net.flow.criteria.PortCriterion; | 59 | import org.onosproject.net.flow.criteria.PortCriterion; |
57 | import org.onosproject.net.flow.criteria.SctpPortCriterion; | 60 | import org.onosproject.net.flow.criteria.SctpPortCriterion; |
58 | import org.onosproject.net.flow.criteria.TcpPortCriterion; | 61 | import org.onosproject.net.flow.criteria.TcpPortCriterion; |
... | @@ -92,6 +95,7 @@ import org.projectfloodlight.openflow.types.U64; | ... | @@ -92,6 +95,7 @@ import org.projectfloodlight.openflow.types.U64; |
92 | import org.projectfloodlight.openflow.types.U8; | 95 | import org.projectfloodlight.openflow.types.U8; |
93 | import org.projectfloodlight.openflow.types.VlanPcp; | 96 | import org.projectfloodlight.openflow.types.VlanPcp; |
94 | import org.projectfloodlight.openflow.types.VlanVid; | 97 | import org.projectfloodlight.openflow.types.VlanVid; |
98 | +import org.projectfloodlight.openflow.types.OduSignalID; | ||
95 | import org.slf4j.Logger; | 99 | import org.slf4j.Logger; |
96 | 100 | ||
97 | import java.util.Optional; | 101 | import java.util.Optional; |
... | @@ -408,7 +412,7 @@ public abstract class FlowModBuilder { | ... | @@ -408,7 +412,7 @@ public abstract class FlowModBuilder { |
408 | OchSignal signal = ochSignalCriterion.lambda(); | 412 | OchSignal signal = ochSignalCriterion.lambda(); |
409 | byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); | 413 | byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); |
410 | byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); | 414 | byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); |
411 | - mBuilder.setExact(MatchField.OCH_SIGID, | 415 | + mBuilder.setExact(MatchField.EXP_OCH_SIG_ID, |
412 | new CircuitSignalID(gridType, channelSpacing, | 416 | new CircuitSignalID(gridType, channelSpacing, |
413 | (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); | 417 | (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); |
414 | } catch (NoMappingFoundException e) { | 418 | } catch (NoMappingFoundException e) { |
... | @@ -416,9 +420,30 @@ public abstract class FlowModBuilder { | ... | @@ -416,9 +420,30 @@ public abstract class FlowModBuilder { |
416 | } | 420 | } |
417 | break; | 421 | break; |
418 | case OCH_SIGTYPE: | 422 | case OCH_SIGTYPE: |
423 | + try { | ||
419 | OchSignalTypeCriterion sc = (OchSignalTypeCriterion) c; | 424 | OchSignalTypeCriterion sc = (OchSignalTypeCriterion) c; |
420 | byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType()); | 425 | byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType()); |
421 | - mBuilder.setExact(MatchField.OCH_SIGTYPE, U8.of(signalType)); | 426 | + mBuilder.setExact(MatchField.EXP_OCH_SIGTYPE, U8.of(signalType)); |
427 | + } catch (NoMappingFoundException e) { | ||
428 | + log.warn(e.getMessage()); | ||
429 | + } | ||
430 | + break; | ||
431 | + case ODU_SIGID: | ||
432 | + OduSignalIdCriterion oduSignalIdCriterion = (OduSignalIdCriterion) c; | ||
433 | + OduSignalId oduSignalId = oduSignalIdCriterion.oduSignalId(); | ||
434 | + mBuilder.setExact(MatchField.EXP_ODU_SIG_ID, | ||
435 | + new OduSignalID((short) oduSignalId.tributaryPortNumber(), | ||
436 | + (short) oduSignalId.tributarySlotLength(), | ||
437 | + oduSignalId.tributarySlotBitmap())); | ||
438 | + break; | ||
439 | + case ODU_SIGTYPE: | ||
440 | + try { | ||
441 | + OduSignalTypeCriterion oduSignalTypeCriterion = (OduSignalTypeCriterion) c; | ||
442 | + byte oduSigType = OpenFlowValueMapper.lookupOduSignalType(oduSignalTypeCriterion.signalType()); | ||
443 | + mBuilder.setExact(MatchField.EXP_ODU_SIGTYPE, U8.of(oduSigType)); | ||
444 | + } catch (NoMappingFoundException e) { | ||
445 | + log.warn(e.getMessage()); | ||
446 | + } | ||
422 | break; | 447 | break; |
423 | case TUNNEL_ID: | 448 | case TUNNEL_ID: |
424 | TunnelIdCriterion tunnelId = (TunnelIdCriterion) c; | 449 | TunnelIdCriterion tunnelId = (TunnelIdCriterion) c; | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java
... | @@ -181,6 +181,7 @@ public class FlowModBuilderVer10 extends FlowModBuilder { | ... | @@ -181,6 +181,7 @@ public class FlowModBuilderVer10 extends FlowModBuilder { |
181 | acts.add(queueBuilder.build()); | 181 | acts.add(queueBuilder.build()); |
182 | break; | 182 | break; |
183 | case L0MODIFICATION: | 183 | case L0MODIFICATION: |
184 | + case L1MODIFICATION: | ||
184 | case GROUP: | 185 | case GROUP: |
185 | case TABLE: | 186 | case TABLE: |
186 | case METADATA: | 187 | case METADATA: | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
... | @@ -19,6 +19,7 @@ import com.google.common.collect.Lists; | ... | @@ -19,6 +19,7 @@ import com.google.common.collect.Lists; |
19 | import org.onlab.packet.Ip4Address; | 19 | import org.onlab.packet.Ip4Address; |
20 | import org.onlab.packet.Ip6Address; | 20 | import org.onlab.packet.Ip6Address; |
21 | import org.onosproject.net.OchSignal; | 21 | import org.onosproject.net.OchSignal; |
22 | +import org.onosproject.net.OduSignalId; | ||
22 | import org.onosproject.net.PortNumber; | 23 | import org.onosproject.net.PortNumber; |
23 | import org.onosproject.net.driver.DefaultDriverData; | 24 | import org.onosproject.net.driver.DefaultDriverData; |
24 | import org.onosproject.net.driver.DefaultDriverHandler; | 25 | import org.onosproject.net.driver.DefaultDriverHandler; |
... | @@ -35,6 +36,8 @@ import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction; | ... | @@ -35,6 +36,8 @@ import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction; |
35 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; | 36 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; |
36 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction; | 37 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction; |
37 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction; | 38 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction; |
39 | +import org.onosproject.net.flow.instructions.L1ModificationInstruction; | ||
40 | +import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction; | ||
38 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; | 41 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
39 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction; | 42 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction; |
40 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction; | 43 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction; |
... | @@ -76,6 +79,7 @@ import org.projectfloodlight.openflow.types.OFBufferId; | ... | @@ -76,6 +79,7 @@ import org.projectfloodlight.openflow.types.OFBufferId; |
76 | import org.projectfloodlight.openflow.types.OFGroup; | 79 | import org.projectfloodlight.openflow.types.OFGroup; |
77 | import org.projectfloodlight.openflow.types.OFPort; | 80 | import org.projectfloodlight.openflow.types.OFPort; |
78 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; | 81 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
82 | +import org.projectfloodlight.openflow.types.OduSignalID; | ||
79 | import org.projectfloodlight.openflow.types.TableId; | 83 | import org.projectfloodlight.openflow.types.TableId; |
80 | import org.projectfloodlight.openflow.types.TransportPort; | 84 | import org.projectfloodlight.openflow.types.TransportPort; |
81 | import org.projectfloodlight.openflow.types.U32; | 85 | import org.projectfloodlight.openflow.types.U32; |
... | @@ -234,6 +238,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -234,6 +238,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
234 | case L0MODIFICATION: | 238 | case L0MODIFICATION: |
235 | actions.add(buildL0Modification(i)); | 239 | actions.add(buildL0Modification(i)); |
236 | break; | 240 | break; |
241 | + case L1MODIFICATION: | ||
242 | + actions.add(buildL1Modification(i)); | ||
243 | + break; | ||
237 | case L2MODIFICATION: | 244 | case L2MODIFICATION: |
238 | actions.add(buildL2Modification(i)); | 245 | actions.add(buildL2Modification(i)); |
239 | break; | 246 | break; |
... | @@ -303,20 +310,31 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -303,20 +310,31 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
303 | 310 | ||
304 | private OFAction buildL0Modification(Instruction i) { | 311 | private OFAction buildL0Modification(Instruction i) { |
305 | L0ModificationInstruction l0m = (L0ModificationInstruction) i; | 312 | L0ModificationInstruction l0m = (L0ModificationInstruction) i; |
313 | + OFOxm<?> oxm = null; | ||
306 | switch (l0m.subtype()) { | 314 | switch (l0m.subtype()) { |
307 | case LAMBDA: | 315 | case LAMBDA: |
308 | return buildModLambdaInstruction((ModLambdaInstruction) i); | 316 | return buildModLambdaInstruction((ModLambdaInstruction) i); |
309 | case OCH: | 317 | case OCH: |
310 | try { | 318 | try { |
311 | - return buildModOchSignalInstruction((ModOchSignalInstruction) i); | 319 | + ModOchSignalInstruction modOchSignalInstruction = (ModOchSignalInstruction) l0m; |
320 | + OchSignal signal = modOchSignalInstruction.lambda(); | ||
321 | + byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); | ||
322 | + byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); | ||
323 | + oxm = factory().oxms().expOchSigId( | ||
324 | + new CircuitSignalID(gridType, channelSpacing, | ||
325 | + (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); | ||
312 | } catch (NoMappingFoundException e) { | 326 | } catch (NoMappingFoundException e) { |
313 | log.warn(e.getMessage()); | 327 | log.warn(e.getMessage()); |
314 | break; | 328 | break; |
315 | } | 329 | } |
330 | + break; | ||
316 | default: | 331 | default: |
317 | log.warn("Unimplemented action type {}.", l0m.subtype()); | 332 | log.warn("Unimplemented action type {}.", l0m.subtype()); |
318 | break; | 333 | break; |
319 | } | 334 | } |
335 | + if (oxm != null) { | ||
336 | + return factory().actions().buildSetField().setField(oxm).build(); | ||
337 | + } | ||
320 | return null; | 338 | return null; |
321 | } | 339 | } |
322 | 340 | ||
... | @@ -336,6 +354,31 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -336,6 +354,31 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
336 | )); | 354 | )); |
337 | } | 355 | } |
338 | 356 | ||
357 | + private OFAction buildL1Modification(Instruction i) { | ||
358 | + L1ModificationInstruction l1m = (L1ModificationInstruction) i; | ||
359 | + OFOxm<?> oxm = null; | ||
360 | + switch (l1m.subtype()) { | ||
361 | + case ODU_SIGID: | ||
362 | + ModOduSignalIdInstruction modOduSignalIdInstruction = (ModOduSignalIdInstruction) l1m; | ||
363 | + OduSignalId oduSignalId = modOduSignalIdInstruction.oduSignalId(); | ||
364 | + | ||
365 | + OduSignalID oduSignalID = new OduSignalID((short) oduSignalId.tributaryPortNumber(), | ||
366 | + (short) oduSignalId.tributarySlotLength(), | ||
367 | + oduSignalId.tributarySlotBitmap()); | ||
368 | + | ||
369 | + oxm = factory().oxms().expOduSigId(oduSignalID); | ||
370 | + break; | ||
371 | + default: | ||
372 | + log.warn("Unimplemented action type {}.", l1m.subtype()); | ||
373 | + break; | ||
374 | + } | ||
375 | + | ||
376 | + if (oxm != null) { | ||
377 | + return factory().actions().buildSetField().setField(oxm).build(); | ||
378 | + } | ||
379 | + return null; | ||
380 | + } | ||
381 | + | ||
339 | private OFAction buildL2Modification(Instruction i) { | 382 | private OFAction buildL2Modification(Instruction i) { |
340 | L2ModificationInstruction l2m = (L2ModificationInstruction) i; | 383 | L2ModificationInstruction l2m = (L2ModificationInstruction) i; |
341 | ModEtherInstruction eth; | 384 | ModEtherInstruction eth; | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowValueMapper.java
... | @@ -20,6 +20,7 @@ import com.google.common.collect.EnumHashBiMap; | ... | @@ -20,6 +20,7 @@ import com.google.common.collect.EnumHashBiMap; |
20 | import org.onosproject.net.ChannelSpacing; | 20 | import org.onosproject.net.ChannelSpacing; |
21 | import org.onosproject.net.GridType; | 21 | import org.onosproject.net.GridType; |
22 | import org.onosproject.net.OchSignalType; | 22 | import org.onosproject.net.OchSignalType; |
23 | +import org.onosproject.net.OduSignalType; | ||
23 | 24 | ||
24 | /** | 25 | /** |
25 | * Collection of helper methods to convert protocol agnostic models to values used in OpenFlow spec. | 26 | * Collection of helper methods to convert protocol agnostic models to values used in OpenFlow spec. |
... | @@ -54,6 +55,17 @@ final class OpenFlowValueMapper { | ... | @@ -54,6 +55,17 @@ final class OpenFlowValueMapper { |
54 | OCH_SIGNAL_TYPES.put(OchSignalType.FLEX_GRID, (byte) 2); // OFPOCHT_FLEX_GRID of enum ofp_och_signal_type | 55 | OCH_SIGNAL_TYPES.put(OchSignalType.FLEX_GRID, (byte) 2); // OFPOCHT_FLEX_GRID of enum ofp_och_signal_type |
55 | } | 56 | } |
56 | 57 | ||
58 | + private static final BiMap<OduSignalType, Byte> ODU_SIGNAL_TYPES = EnumHashBiMap.create(OduSignalType.class); | ||
59 | + static { | ||
60 | + // See ONF "Optical Transport Protocol Extensions Version 1.0" for the following values | ||
61 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU1, (byte) 1); // OFPODUT_ODU1 of enum ofp_odu_signal_type | ||
62 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU2, (byte) 2); // OFPODUT_ODU2 of enum ofp_odu_signal_type | ||
63 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU3, (byte) 3); // OFPODUT_ODU3 of enum ofp_odu_signal_type | ||
64 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU4, (byte) 4); // OFPODUT_ODU4 of enum ofp_odu_signal_type | ||
65 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU0, (byte) 10); // OFPODUT_ODU0 of enum ofp_odu_signal_type | ||
66 | + ODU_SIGNAL_TYPES.put(OduSignalType.ODU2e, (byte) 11); // OFPODUT_ODU2E of enum ofp_odu_signal_type | ||
67 | + } | ||
68 | + | ||
57 | /** | 69 | /** |
58 | * Looks up the specified input value to the corresponding value with the specified map. | 70 | * Looks up the specified input value to the corresponding value with the specified map. |
59 | * | 71 | * |
... | @@ -149,4 +161,30 @@ final class OpenFlowValueMapper { | ... | @@ -149,4 +161,30 @@ final class OpenFlowValueMapper { |
149 | static OchSignalType lookupOchSignalType(byte signalType) { | 161 | static OchSignalType lookupOchSignalType(byte signalType) { |
150 | return lookup(OCH_SIGNAL_TYPES.inverse(), signalType, OchSignalType.class); | 162 | return lookup(OCH_SIGNAL_TYPES.inverse(), signalType, OchSignalType.class); |
151 | } | 163 | } |
164 | + | ||
165 | + /** | ||
166 | + * Looks up the corresponding byte value for ODU signal type defined in | ||
167 | + * ONF "Optical Transport Protocol Extensions Version 1.0" | ||
168 | + * from the specified {@link OchSignalType} instance. | ||
169 | + * | ||
170 | + * @param signalType ODU (Optical channel Data Unit) signal type | ||
171 | + * @return byte value corresponding to the specified ODU signal type | ||
172 | + * @throws NoMappingFoundException if the specified ODU signal type is not found | ||
173 | + */ | ||
174 | + static byte lookupOduSignalType(OduSignalType signalType) { | ||
175 | + return lookup(ODU_SIGNAL_TYPES, signalType, Byte.class); | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * Looks up the the corresponding {@link OchSignalType} instance | ||
180 | + * from the specified byte value for ODU signal type defined in | ||
181 | + * ONF "Optical Transport Protocol Extensions Version 1.0". | ||
182 | + * | ||
183 | + * @param signalType byte value as ODU (Optical channel Data Unit) signal type defined the spec | ||
184 | + * @return the corresponding OchSignalType instance | ||
185 | + * @throws NoMappingFoundException if the specified ODU signal type is not found | ||
186 | + */ | ||
187 | + static OduSignalType lookupOduSignalType(byte signalType) { | ||
188 | + return lookup(ODU_SIGNAL_TYPES.inverse(), signalType, OduSignalType.class); | ||
189 | + } | ||
152 | } | 190 | } | ... | ... |
-
Please register or login to post a comment