@Override public ExtensionSelector mapOxm(OFOxm<?> oxm) { if (oxm.getMatchField() == MatchField.NSP) { OFOxmNsp oxmField = (OFOxmNsp) oxm; return new NiciraMatchNshSpi(NshServicePathId.of(oxmField.getValue().getRaw())); } if (oxm.getMatchField() == MatchField.NSI) { OFOxmNsi oxmField = (OFOxmNsi) oxm; return new NiciraMatchNshSi(NshServiceIndex.of(oxmField.getValue().getRaw())); } if (oxm.getMatchField() == MatchField.ENCAP_ETH_TYPE) { OFOxmEncapEthType oxmField = (OFOxmEncapEthType) oxm; return new NiciraMatchEncapEthType(oxmField.getValue().getRaw()); } return null; }
@Override public OFOxm<?> mapSelector(OFFactory factory, ExtensionSelector extensionSelector) { ExtensionSelectorType type = extensionSelector.type(); if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SPI.type())) { NiciraMatchNshSpi niciraNshSpi = (NiciraMatchNshSpi) extensionSelector; return factory.oxms().nsp(U32.of(niciraNshSpi.nshSpi().servicePathId())); } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SI.type())) { NiciraMatchNshSi niciraNshSi = (NiciraMatchNshSi) extensionSelector; return factory.oxms().nsi(U8.of(niciraNshSi.nshSi().serviceIndex())); } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_ENCAP_ETH_TYPE.type())) { NiciraMatchEncapEthType niciraEncapEthType = (NiciraMatchEncapEthType) extensionSelector; return factory.oxms().encapEthType(U16.of(niciraEncapEthType.encapEthType())); } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH1.type())) { // TODO } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH2.type())) { // TODO } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH3.type())) { // TODO } if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH4.type())) { // TODO } return null; }
break; case ICMPV6_TYPE: byte icmpv6type = (byte) match.get(MatchField.ICMPV6_TYPE).getValue(); builder.matchIcmpv6Type(icmpv6type); break; case ICMPV6_CODE: byte icmpv6code = (byte) match.get(MatchField.ICMPV6_CODE).getValue(); builder.matchIcmpv6Code(icmpv6code); break; case OCH_SIGTYPE: U8 sigType = match.get(MatchField.OCH_SIGTYPE); builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue()))); break; case EXP_OCH_SIG_ID: try { U8 expOchSigType = match.get(MatchField.EXP_OCH_SIGTYPE); builder.add(matchOchSignalType(lookupOchSignalType((byte) expOchSigType.getValue()))); } catch (NoMappingFoundException e) { log.warn(e.getMessage()); try { U8 oduSigType = match.get(MatchField.EXP_ODU_SIGTYPE); builder.add(matchOduSignalType(lookupOduSignalType((byte) oduSigType.getValue()))); } catch (NoMappingFoundException e) { log.warn(e.getMessage());
return factory.actions().setField(factory.oxms().nsi(U8.of(niciraNshSi.nshSi().serviceIndex()))); return factory.actions().setField(factory.oxms().nshMdtype(U8.of(niciraNshMdType.nshMdType()))); return factory.actions().setField(factory.oxms().nshNp(U8.of(niciraNshNp.nshNp()))); return factory.actions().setField(factory.oxms().tunGpeNp(U8.of(niciraTunGpeNp.tunGpeNp())));
Icmpv6TypeCriterion icmpv6Type = (Icmpv6TypeCriterion) c; mBuilder.setExact(MatchField.ICMPV6_TYPE, U8.of(icmpv6Type.icmpv6Type())); break; case ICMPV6_CODE: Icmpv6CodeCriterion icmpv6Code = (Icmpv6CodeCriterion) c; mBuilder.setExact(MatchField.ICMPV6_CODE, U8.of(icmpv6Code.icmpv6Code())); break; case IPV6_ND_TARGET: OchSignalTypeCriterion sc = (OchSignalTypeCriterion) c; byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType()); mBuilder.setExact(MatchField.EXP_OCH_SIGTYPE, U8.of(signalType)); } catch (NoMappingFoundException e) { log.warn(e.getMessage()); OduSignalTypeCriterion oduSignalTypeCriterion = (OduSignalTypeCriterion) c; byte oduSigType = OpenFlowValueMapper.lookupOduSignalType(oduSignalTypeCriterion.signalType()); mBuilder.setExact(MatchField.EXP_ODU_SIGTYPE, U8.of(oduSigType)); } catch (NoMappingFoundException e) { log.warn(e.getMessage());
case NSI: OFOxmNsi nsi = (OFOxmNsi) oxm; return new NiciraSetNshSi(NshServiceIndex.of((nsi.getValue().getRaw()))); case NSH_C1: OFOxmNshC1 nshC1 = (OFOxmNshC1) oxm; case NSH_MDTYPE: OFOxmNshMdtype nshMdType = (OFOxmNshMdtype) oxm; return new NiciraNshMdType((nshMdType.getValue().getRaw())); case NSH_NP: OFOxmNshNp nshNp = (OFOxmNshNp) oxm; return new NiciraNshNp((nshNp.getValue().getRaw())); case ENCAP_ETH_SRC: OFOxmEncapEthSrc encapEthSrc = (OFOxmEncapEthSrc) oxm; case TUN_GPE_NP: OFOxmTunGpeNp tunGpeNp = (OFOxmTunGpeNp) oxm; return new NiciraTunGpeNp((tunGpeNp.getValue().getRaw())); default: throw new UnsupportedOperationException(