private OFAction buildL2Modification(Instruction i) { L2ModificationInstruction l2m = (L2ModificationInstruction) i; ModEtherInstruction eth; switch (l2m.subtype()) { case ETH_DST: eth = (ModEtherInstruction) l2m; return factory().actions().setDlDst(MacAddress.of(eth.mac().toLong())); case ETH_SRC: eth = (ModEtherInstruction) l2m; return factory().actions().setDlSrc(MacAddress.of(eth.mac().toLong())); case VLAN_ID: ModVlanIdInstruction vlanId = (ModVlanIdInstruction) l2m; return factory().actions().setVlanVid(VlanVid.ofVlan(vlanId.vlanId().toShort())); case VLAN_PCP: ModVlanPcpInstruction vlanPcp = (ModVlanPcpInstruction) l2m; return factory().actions().setVlanPcp(VlanPcp.of(vlanPcp.vlanPcp())); case VLAN_POP: return factory().actions().stripVlan(); case VLAN_PUSH: return null; default: log.warn("Unimplemented action type {}.", l2m.subtype()); break; } return null; }
/** * Build a portDescription from a given Ethernet port description. * * @param port the port to build from. * @return portDescription for the port. */ private PortDescription buildPortDescription(OFPortDesc port) { PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) && !port.getConfig().contains(OFPortConfig.PORT_DOWN); Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER; SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString()); return new DefaultPortDescription(portNo, enabled, type, portSpeed(port), annotations); }
OFOxm<org.projectfloodlight.openflow.types.MacAddress> ethdst = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm; builder.setEthDst(MacAddress.valueOf(ethdst.getValue().getLong())); break; case ETH_SRC: OFOxm<org.projectfloodlight.openflow.types.MacAddress> ethsrc = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm; builder.setEthSrc(MacAddress.valueOf(ethsrc.getValue().getLong())); break; case IPV4_DST: OFOxm<org.projectfloodlight.openflow.types.MacAddress> arpsha = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm; builder.setArpSha(MacAddress.valueOf(arpsha.getValue().getLong())); break; case ARP_SPA:
case ENCAP_ETH_SRC: OFOxmEncapEthSrc encapEthSrc = (OFOxmEncapEthSrc) oxm; return new NiciraEncapEthSrc(org.onlab.packet.MacAddress.valueOf((encapEthSrc.getValue().getBytes()))); case ENCAP_ETH_DST: OFOxmEncapEthDst encapEthDst = (OFOxmEncapEthDst) oxm; return new NiciraEncapEthDst(org.onlab.packet.MacAddress.valueOf((encapEthDst.getValue().getBytes()))); case ENCAP_ETH_TYPE: OFOxmEncapEthType encapEthType = (OFOxmEncapEthType) oxm;
Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_DST); builder.matchEthDstMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong())); } else { mac = MacAddress.valueOf(match.get(MatchField.ETH_DST).getLong()); builder.matchEthDst(mac); Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_SRC); builder.matchEthSrcMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong())); } else { mac = MacAddress.valueOf(match.get(MatchField.ETH_SRC).getLong()); builder.matchEthSrc(mac); break; case IPV6_ND_SLL: mac = MacAddress.valueOf(match.get(MatchField.IPV6_ND_SLL).getLong()); builder.matchIPv6NDSourceLinkLayerAddress(mac); break; case IPV6_ND_TLL: mac = MacAddress.valueOf(match.get(MatchField.IPV6_ND_TLL).getLong()); builder.matchIPv6NDTargetLinkLayerAddress(mac); break; break; case ARP_SHA: mac = MacAddress.valueOf(match.get(MatchField.ARP_SHA).getLong());
case ETH_DST: eth = (L2ModificationInstruction.ModEtherInstruction) l2m; oxm = factory.oxms().ethDst(MacAddress.of(eth.mac().toLong())); break; case ETH_SRC: eth = (L2ModificationInstruction.ModEtherInstruction) l2m; oxm = factory.oxms().ethSrc(MacAddress.of(eth.mac().toLong())); break; case VLAN_ID:
SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
/** * Build a portDescription from a given port description describing a fiber switch optical port. * * @param port description property type. * @param port the port to build from. * @return portDescription for the port. */ private PortDescription buildPortDescription(OFCalientPortDescStatsEntry port) { PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); // Use the alias name if it's available String name = port.getName(); List<OFCalientPortDescProp> props = port.getProperties(); if (props != null && props.size() > 0) { OFCalientPortDescPropOptical propOptical = (OFCalientPortDescPropOptical) props.get(0); if (propOptical != null) { name = propOptical.getInAlias(); } } // FIXME when Calient OF agent reports port status boolean enabled = true; SparseAnnotations annotations = makePortAnnotation(name, port.getHwAddr().toString()); // S160 data sheet // Wavelength range: 1260 - 1630 nm, grid is irrelevant for this type of switch return omsPortDescription(portNo, enabled, Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(100), annotations); }
ethCriterion = (EthCriterion) c; mBuilder.setExact(MatchField.ETH_DST, MacAddress.of(ethCriterion.mac().toLong())); break; case ETH_DST_MASKED: ethCriterion = (EthCriterion) c; mBuilder.setMasked(MatchField.ETH_DST, MacAddress.of(ethCriterion.mac().toLong()), MacAddress.of(ethCriterion.mask().toLong())); break; case ETH_SRC: ethCriterion = (EthCriterion) c; mBuilder.setExact(MatchField.ETH_SRC, MacAddress.of(ethCriterion.mac().toLong())); break; case ETH_SRC_MASKED: ethCriterion = (EthCriterion) c; mBuilder.setMasked(MatchField.ETH_SRC, MacAddress.of(ethCriterion.mac().toLong()), MacAddress.of(ethCriterion.mask().toLong())); break; case ETH_TYPE: (IPv6NDLinkLayerAddressCriterion) c; mBuilder.setExact(MatchField.IPV6_ND_SLL, MacAddress.of(llAddressCriterion.mac().toLong())); break; case IPV6_ND_TLL:
private PortDescription buildPortDescription(OFPortStatus status) { OFPortDesc port = status.getDesc(); if (status.getReason() != OFPortReason.DELETE) { return buildPortDescription(port); } else { PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER; SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString()); return new DefaultPortDescription(portNo, false, type, portSpeed(port), annotations); } }
case ARP_SHA: ModArpEthInstruction ei = (ModArpEthInstruction) i; oxm = factory().oxms().arpSha(MacAddress.of(ei.mac().toLong())); break; case ARP_OP:
boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) && !port.getConfig().contains(OFPortConfig.PORT_DOWN); SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());