本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress类的典型用法代码示例。如果您正苦于以下问题:Java MacAddress类的具体用法?Java MacAddress怎么用?Java MacAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MacAddress类属于org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715包,在下文中一共展示了MacAddress类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: programConntrackRecircRules
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Adds the rule to send the packet to the netfilter to check whether it is
* a known packet.
*
* @param dpId the dpId
* @param allowedAddresses the allowed addresses
* @param priority the priority of the flow
* @param flowId the flowId
* @param conntrackState the conntrack state of the packets thats should be
* send
* @param conntrackMask the conntrack mask
* @param portId the portId
* @param addOrRemove whether to add or remove the flow
*/
private void programConntrackRecircRules(BigInteger dpId, List<AllowedAddressPairs> allowedAddresses,
Integer priority, String flowId, String portId, int addOrRemove) {
for (AllowedAddressPairs allowedAddress : allowedAddresses) {
IpPrefixOrAddress attachIp = allowedAddress.getIpAddress();
MacAddress attachMac = allowedAddress.getMacAddress();
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(new MatchEthernetSource(attachMac));
matches.addAll(AclServiceUtils.buildIpMatches(attachIp, MatchCriteria.MATCH_SOURCE));
Long elanTag = getElanIdFromAclInterface(portId);
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag.intValue(),
NwConstants.INGRESS_ACL_REMOTE_ACL_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
String flowName = "Egress_Fixed_Conntrk_" + dpId + "_" + attachMac.getValue() + "_"
+ String.valueOf(attachIp.getValue()) + "_" + flowId;
syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:38,代码来源:StatefulEgressAclServiceImpl.java
示例2: programConntrackRecircRules
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Adds the rule to send the packet to the netfilter to check whether it is
* a known packet.
*
* @param dpId the dpId
* @param allowedAddresses the allowed addresses
* @param priority the priority of the flow
* @param flowId the flowId
* @param conntrackState the conntrack state of the packets thats should be
* send
* @param conntrackMask the conntrack mask
* @param portId the portId
* @param addOrRemove whether to add or remove the flow
*/
private void programConntrackRecircRules(BigInteger dpId, List<AllowedAddressPairs> allowedAddresses,
Integer priority, String flowId, String portId, int addOrRemove) {
for (AllowedAddressPairs allowedAddress : allowedAddresses) {
IpPrefixOrAddress attachIp = allowedAddress.getIpAddress();
MacAddress attachMac = allowedAddress.getMacAddress();
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchEthernetDestination(attachMac));
matches.addAll(AclServiceUtils.buildIpMatches(attachIp, MatchCriteria.MATCH_DESTINATION));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
Long elanTag = getElanIdFromAclInterface(portId);
actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag.intValue(),
NwConstants.EGRESS_ACL_REMOTE_ACL_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
String flowName = "Ingress_Fixed_Conntrk_" + dpId + "_" + attachMac.getValue() + "_"
+ String.valueOf(attachIp.getValue()) + "_" + flowId;
syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:39,代码来源:StatefulIngressAclServiceImpl.java
示例3: programGeneralFixedRules
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
@Override
protected void programGeneralFixedRules(AclInterface port, String dhcpMacAddress,
List<AllowedAddressPairs> allowedAddresses, Action action, int addOrRemove) {
LOG.info("programFixedRules : {} default rules.", action == Action.ADD ? "adding" : "removing");
BigInteger dpid = port.getDpId();
int lportTag = port.getLPortTag();
if (action == Action.ADD || action == Action.REMOVE) {
Set<MacAddress> aapMacs =
allowedAddresses.stream().map(aap -> aap.getMacAddress()).collect(Collectors.toSet());
egressAclDhcpAllowClientTraffic(dpid, aapMacs, lportTag, addOrRemove);
egressAclDhcpv6AllowClientTraffic(dpid, aapMacs, lportTag, addOrRemove);
egressAclDhcpDropServerTraffic(dpid, dhcpMacAddress, lportTag, addOrRemove);
egressAclDhcpv6DropServerTraffic(dpid, dhcpMacAddress, lportTag, addOrRemove);
egressAclIcmpv6DropRouterAdvts(dpid, lportTag, addOrRemove);
egressAclIcmpv6AllowedList(dpid, lportTag, addOrRemove);
programArpRule(dpid, allowedAddresses, lportTag, addOrRemove);
programL2BroadcastAllowRule(port, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:AbstractEgressAclServiceImpl.java
示例4: egressAclDhcpAllowClientTraffic
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Add rule to ensure only DHCP server traffic from the specified mac is
* allowed.
*
* @param dpId the dpid
* @param aapMacs the AAP mac addresses
* @param lportTag the lport tag
* @param addOrRemove whether to add or remove the flow
*/
private void egressAclDhcpAllowClientTraffic(BigInteger dpId, Set<MacAddress> aapMacs, int lportTag,
int addOrRemove) {
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(actionsInfos);
for (MacAddress aapMac : aapMacs) {
List<MatchInfoBase> matches = new ArrayList<>();
matches.addAll(AclServiceUtils.buildDhcpMatches(AclConstants.DHCP_CLIENT_PORT_IPV4,
AclConstants.DHCP_SERVER_PORT_IPV4, lportTag, ServiceModeEgress.class));
matches.add(new MatchEthernetSource(aapMac));
String flowName = "Egress_DHCP_Client_v4" + dpId + "_" + lportTag + "_" + aapMac.getValue() + "_Permit_";
syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName,
AclConstants.PROTO_DHCP_CLIENT_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE,
matches, instructions, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:AbstractEgressAclServiceImpl.java
示例5: egressAclDhcpv6AllowClientTraffic
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Add rule to ensure only DHCPv6 server traffic from the specified mac is
* allowed.
*
* @param dpId the dpid
* @param aapMacs the AAP mac addresses
* @param lportTag the lport tag
* @param addOrRemove whether to add or remove the flow
*/
private void egressAclDhcpv6AllowClientTraffic(BigInteger dpId, Set<MacAddress> aapMacs, int lportTag,
int addOrRemove) {
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(actionsInfos);
for (MacAddress aapMac : aapMacs) {
List<MatchInfoBase> matches = new ArrayList<>();
matches.addAll(AclServiceUtils.buildDhcpV6Matches(AclConstants.DHCP_CLIENT_PORT_IPV6,
AclConstants.DHCP_SERVER_PORT_IPV6, lportTag, ServiceModeEgress.class));
matches.add(new MatchEthernetSource(aapMac));
String flowName = "Egress_DHCP_Client_v6" + "_" + dpId + "_" + lportTag + "_" + aapMac.getValue()
+ "_Permit_";
syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName,
AclConstants.PROTO_DHCP_CLIENT_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE,
matches, instructions, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:AbstractEgressAclServiceImpl.java
示例6: programL2BroadcastAllowRule
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Programs Non-IP broadcast rules.
*
* @param port the Acl Interface port
* @param addOrRemove whether to delete or add flow
*/
private void programL2BroadcastAllowRule(AclInterface port, int addOrRemove) {
BigInteger dpId = port.getDpId();
int lportTag = port.getLPortTag();
List<AllowedAddressPairs> allowedAddresses = port.getAllowedAddressPairs();
Set<MacAddress> macs = allowedAddresses.stream().map(aap -> aap.getMacAddress()).collect(Collectors.toSet());
for (MacAddress mac : macs) {
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(new MatchEthernetSource(mac));
matches.add(buildLPortTagMatch(lportTag));
List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>());
String flowName = "Egress_L2Broadcast_" + dpId + "_" + lportTag + "_" + mac.getValue();
syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName,
AclConstants.PROTO_L2BROADCAST_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE,
matches, instructions, addOrRemove);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:AbstractEgressAclServiceImpl.java
示例7: makeL3GwMacTableEntry
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
static void makeL3GwMacTableEntry(final BigInteger dpnId, final long vpnId, String macAddress,
List<Instruction> customInstructions, IMdsalApiManager mdsalManager,
WriteTransaction writeFlowTx) {
List<MatchInfo> matchInfo = new ArrayList<>();
matchInfo.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
matchInfo.add(new MatchEthernetDestination(new MacAddress(macAddress)));
LOG.debug("makeL3GwMacTableEntry : Create flow table {} -> table {} for External Vpn Id = {} "
+ "and MacAddress = {} on DpnId = {}",
NwConstants.L3_GW_MAC_TABLE, NwConstants.INBOUND_NAPT_TABLE, vpnId, macAddress, dpnId);
// Install the flow entry in L3_GW_MAC_TABLE
String flowRef = NatUtil.getFlowRef(dpnId, NwConstants.L3_GW_MAC_TABLE, vpnId, macAddress);
Flow l3GwMacTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_GW_MAC_TABLE,
flowRef, 21, flowRef, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, matchInfo, customInstructions);
mdsalManager.addFlowToTx(dpnId, l3GwMacTableFlowEntity, writeFlowTx);
LOG.debug("makeL3GwMacTableEntry : Successfully created flow entity {} on DPN = {}",
l3GwMacTableFlowEntity, dpnId);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:NatEvpnUtil.java
示例8: removeL3GwMacTableEntry
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
static void removeL3GwMacTableEntry(final BigInteger dpnId, final long vpnId, final String macAddress,
IMdsalApiManager mdsalManager, WriteTransaction removeFlowInvTx) {
List<MatchInfo> matchInfo = new ArrayList<>();
matchInfo.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
matchInfo.add(new MatchEthernetSource(new MacAddress(macAddress)));
LOG.debug("removeL3GwMacTableEntry : Remove flow table {} -> table {} for External Vpn Id = {} "
+ "and MacAddress = {} on DpnId = {}",
NwConstants.L3_GW_MAC_TABLE, NwConstants.INBOUND_NAPT_TABLE, vpnId, macAddress, dpnId);
// Remove the flow entry in L3_GW_MAC_TABLE
String flowRef = NatUtil.getFlowRef(dpnId, NwConstants.L3_GW_MAC_TABLE, vpnId, macAddress);
Flow l3GwMacTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_GW_MAC_TABLE,
flowRef, 21, flowRef, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, matchInfo, null);
mdsalManager.removeFlowToTx(dpnId, l3GwMacTableFlowEntity, removeFlowInvTx);
LOG.debug("removeL3GwMacTableEntry : Successfully removed flow entity {} on DPN = {}",
l3GwMacTableFlowEntity, dpnId);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:NatEvpnUtil.java
示例9: makeLFibTableEntry
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
private void makeLFibTableEntry(BigInteger dpId, long serviceId, String floatingIpPortMacAddress, short tableId,
WriteTransaction writeFlowInvTx) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.MPLS_UNICAST);
matches.add(new MatchMplsLabel(serviceId));
List<Instruction> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPopMpls());
actionsInfos.add(new ActionSetFieldEthernetDestination(new MacAddress(floatingIpPortMacAddress)));
Instruction writeInstruction = new InstructionApplyActions(actionsInfos).buildInstruction(0);
instructions.add(writeInstruction);
instructions.add(new InstructionGotoTable(tableId).buildInstruction(1));
// Install the flow entry in L3_LFIB_TABLE
String flowRef = getFlowRef(dpId, NwConstants.L3_LFIB_TABLE, serviceId, "");
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_LFIB_TABLE, flowRef,
10, flowRef, 0, 0,
NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
mdsalManager.addFlowToTx(dpId, flowEntity, writeFlowInvTx);
LOG.debug("makeLFibTableEntry : LFIB Entry for dpID {} : label : {} modified successfully {}", dpId, serviceId);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:VpnFloatingIpHandler.java
示例10: createOutboundTblTrackEntry
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
protected void createOutboundTblTrackEntry(BigInteger dpnId, Long routerId, String extGwMacAddress,
int addOrRemove) {
LOG.info("createOutboundTblTrackEntry : called for switch {}, routerId {}", dpnId, routerId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
if (addOrRemove == NwConstants.ADD_FLOW) {
listActionInfo.add(new ActionSetFieldEthernetSource(new MacAddress(extGwMacAddress)));
}
ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
listActionInfo.add(new ActionNxResubmit(NwConstants.NAPT_PFIB_TABLE));
instructionInfo.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
flowRef += "trkest";
syncFlow(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef,
NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo, addOrRemove);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:ConntrackBasedSnatService.java
示例11: buildEthMatchTest
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
@Test
public void buildEthMatchTest() {
AceEthBuilder aceEthBuilder = new AceEthBuilder();
aceEthBuilder.setDestinationMacAddress(new MacAddress(MAC_DST_STR));
aceEthBuilder.setSourceMacAddress(new MacAddress(MAC_SRC_STR));
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceEthBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// The ethernet match should be there with src/dst values
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetSource().getAddress().getValue(), MAC_SRC_STR);
assertEquals(ethMatch.getEthernetDestination().getAddress().getValue(), MAC_DST_STR);
// The rest should be null
assertNull(matchBuilder.getIpMatch());
assertNull(matchBuilder.getLayer3Match());
assertNull(matchBuilder.getLayer4Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:AclMatchesTest.java
示例12: add
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
@Override
protected void add(InstanceIdentifier<LearntVpnVipToPort> identifier, LearntVpnVipToPort value) {
runOnlyInOwnerNode("ArpMonitoringHandler: add event", () -> {
try {
InetAddress srcInetAddr = InetAddress.getByName(value.getPortFixedip());
if (value.getMacAddress() == null) {
LOG.warn("The mac address received is null for VpnPortipToPort {}, ignoring the DTCN", value);
return;
}
MacAddress srcMacAddress = MacAddress.getDefaultInstance(value.getMacAddress());
String vpnName = value.getVpnName();
MacEntry macEntry = new MacEntry(vpnName, srcMacAddress, srcInetAddr, value.getPortName(),
value.getCreationTime());
jobCoordinator.enqueueJob(buildJobKey(srcInetAddr.toString(), vpnName),
new ArpMonitorStartTask(macEntry, arpMonitorProfileId, dataBroker, alivenessManager,
interfaceRpc, neutronVpnService, interfaceManager));
} catch (UnknownHostException e) {
LOG.error("Error in deserializing packet {} with exception", value, e);
}
});
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:ArpMonitoringHandler.java
示例13: buildL3vpnGatewayFlow
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
public static FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId,
long subnetVpnId) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
if (subnetVpnId != VpnConstants.INVALID_ID) {
BigInteger subnetIdMetaData = MetaDataUtil.getVpnIdMetadata(subnetVpnId);
mkInstructions.add(new InstructionWriteMetadata(subnetIdMetaData, MetaDataUtil.METADATA_MASK_VRFID));
}
String flowId = getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE,
flowId, 20, flowId, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, mkMatches, mkInstructions);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:VpnUtil.java
示例14: getIpv6MulticastMacAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
public static MacAddress getIpv6MulticastMacAddress(Ipv6Address ipv6Address) {
/* According to RFC 2464, a Multicast MAC address is derived by concatenating 32 lower
order bits of IPv6 Multicast Address with the multicast prefix (i.e., 33:33).
Example: For Multicast IPv6Address of FF02::1:FF28:9C5A, the corresponding L2 multicast
address would be 33:33:28:9C:5A
*/
byte[] octets;
try {
octets = InetAddress.getByName(ipv6Address.getValue()).getAddress();
} catch (UnknownHostException e) {
LOG.error("getIpv6MulticastMacAddress: Failed to serialize ipv6Address ", e);
return null;
}
StringBuffer macAddress = new StringBuffer();
macAddress.append("33:33:");
macAddress.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[12]), 2, "0") + ":");
macAddress.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[13]), 2, "0") + ":");
macAddress.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[14]), 2, "0") + ":");
macAddress.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[15]), 2, "0"));
return new MacAddress(macAddress.toString());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:Ipv6ServiceUtils.java
示例15: getAllowedAddressPairsForFixedIps
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Gets the allowed address pairs for fixed ips.
*
* @param aclInterfaceAllowedAddressPairs the acl interface allowed address pairs
* @param portMacAddress the port mac address
* @param origFixedIps the orig fixed ips
* @param newFixedIps the new fixed ips
* @return the allowed address pairs for fixed ips
*/
protected static List<AllowedAddressPairs> getAllowedAddressPairsForFixedIps(
List<AllowedAddressPairs> aclInterfaceAllowedAddressPairs, MacAddress portMacAddress,
List<FixedIps> origFixedIps, List<FixedIps> newFixedIps) {
List<FixedIps> addedFixedIps = getFixedIpsDelta(newFixedIps, origFixedIps);
List<FixedIps> deletedFixedIps = getFixedIpsDelta(origFixedIps, newFixedIps);
List<AllowedAddressPairs> updatedAllowedAddressPairs =
aclInterfaceAllowedAddressPairs != null
? new ArrayList<>(aclInterfaceAllowedAddressPairs) : new ArrayList<>();
if (deletedFixedIps != null) {
updatedAllowedAddressPairs.removeAll(getAllowedAddressPairsForAclService(portMacAddress, deletedFixedIps));
}
if (addedFixedIps != null) {
updatedAllowedAddressPairs.addAll(getAllowedAddressPairsForAclService(portMacAddress, addedFixedIps));
}
return updatedAllowedAddressPairs;
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:NeutronvpnUtils.java
示例16: sendArpRequest
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void sendArpRequest(IpAddress srcIpAddress, IpAddress dstIpAddress, MacAddress srcMacAddress,
String interfaceName) {
if (srcIpAddress == null || dstIpAddress == null) {
LOG.trace("Skip sending ARP to external GW srcIp {} dstIp {}", srcIpAddress, dstIpAddress);
return;
}
PhysAddress srcMacPhysAddress = new PhysAddress(srcMacAddress.getValue());
try {
InterfaceAddress interfaceAddress = new InterfaceAddressBuilder().setInterface(interfaceName)
.setIpAddress(srcIpAddress).setMacaddress(srcMacPhysAddress).build();
SendArpRequestInput sendArpRequestInput = new SendArpRequestInputBuilder().setIpaddress(dstIpAddress)
.setInterfaceAddress(Collections.singletonList(interfaceAddress)).build();
ListenableFutures.addErrorLogging(JdkFutureAdapters.listenInPoolThread(
arpUtilService.sendArpRequest(sendArpRequestInput)), LOG, "Send ARP request");
} catch (Exception e) {
LOG.error("Failed to send ARP request to external GW {} from interface {}",
dstIpAddress.getIpv4Address().getValue(), interfaceName, e);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:NeutronSubnetGwMacResolver.java
示例17: putRemoteMcastMac
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Put remote mcast mac in config DS.
*
* @param transaction
* the transaction
* @param nodeId
* the node id
* @param logicalSwitchName
* the logical switch name
* @param tepIps
* the tep ips
*/
private static void putRemoteMcastMac(WriteTransaction transaction, NodeId nodeId, String logicalSwitchName,
ArrayList<IpAddress> tepIps) {
List<LocatorSet> locators = new ArrayList<>();
for (IpAddress tepIp : tepIps) {
HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
.createHwvtepPhysicalLocatorAugmentation(String.valueOf(tepIp.getValue()));
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(
HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug));
locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
}
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(HwvtepSouthboundUtils
.createLogicalSwitchesInstanceIdentifier(nodeId, new HwvtepNodeName(logicalSwitchName)));
RemoteMcastMacs remoteMcastMac = new RemoteMcastMacsBuilder()
.setMacEntryKey(new MacAddress(ElanConstants.UNKNOWN_DMAC)).setLogicalSwitchRef(lsRef)
.setLocatorSet(locators).build();
InstanceIdentifier<RemoteMcastMacs> iid = HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(nodeId,
remoteMcastMac.getKey());
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY,
iid, remoteMcastMac);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:35,代码来源:ElanL2GatewayMulticastUtils.java
示例18: getRemoteUcastMacs
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Gets the remote ucast macs from hwvtep node filtering based on logical
* switch.
*
* @param hwvtepNodeId
* the hwvtep node id
* @param logicalSwitch
* the logical switch
* @param datastoreType
* the datastore type
* @return the remote ucast macs
*/
public List<MacAddress> getRemoteUcastMacs(NodeId hwvtepNodeId, String logicalSwitch,
LogicalDatastoreType datastoreType) {
List<MacAddress> lstMacs = Collections.emptyList();
Node hwvtepNode = HwvtepUtils.getHwVtepNode(broker, datastoreType, hwvtepNodeId);
if (hwvtepNode != null) {
List<RemoteUcastMacs> remoteUcastMacs = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class)
.getRemoteUcastMacs();
if (remoteUcastMacs != null && !remoteUcastMacs.isEmpty()) {
// Filtering remoteUcastMacs based on the logical switch and
// forming a list of MacAddress
lstMacs = remoteUcastMacs.stream()
.filter(mac -> logicalSwitch.equals(mac.getLogicalSwitchRef().getValue()
.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue()))
.map(HwvtepMacTableGenericAttributes::getMacEntryKey).collect(Collectors.toList());
}
}
return lstMacs;
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:31,代码来源:ElanL2GatewayUtils.java
示例19: deleteL2GwDeviceUcastLocalMacsFromElan
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
/**
* Delete l2 gateway device ucast local macs from elan.<br>
* Deletes macs from internal ELAN nodes and also on rest of external l2
* gateway devices which are part of the ELAN.
*
* @param l2GatewayDevice
* the l2 gateway device whose ucast local macs to be deleted
* from elan
* @param elanName
* the elan name
* @return the listenable future
*/
public List<ListenableFuture<Void>> deleteL2GwDeviceUcastLocalMacsFromElan(L2GatewayDevice l2GatewayDevice,
String elanName) {
LOG.info("Deleting L2GatewayDevice [{}] UcastLocalMacs from elan [{}]", l2GatewayDevice.getHwvtepNodeId(),
elanName);
ElanInstance elan = ElanUtils.getElanInstanceByName(broker, elanName);
if (elan == null) {
LOG.error("Could not find Elan by name: {}", elanName);
return Collections.emptyList();
}
List<MacAddress> localMacs = getL2GwDeviceLocalMacs(l2GatewayDevice);
unInstallL2GwUcastMacFromElan(elan, l2GatewayDevice, localMacs);
return Collections.emptyList();
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:28,代码来源:ElanL2GatewayUtils.java
示例20: call
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入依赖的package包/类
@Override
public List<ListenableFuture<Void>> call() throws Exception {
if (cancelled) {
LOG.info("Delete logical switch job cancelled ");
return Collections.emptyList();
}
LOG.debug("running logical switch deleted job for {} in {}", logicalSwitchName, hwvtepNodeId);
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(HwvtepUtils.deleteLogicalSwitch(broker, hwvtepNodeId, logicalSwitchName));
/*
Adding extra code to delete entries related to logicalswitch , in case they exist while deleting
logicalSwitch.
In UT , while macs are being pushed from southbound in to l2gw Device and at the same time l2Gw Connection
is deleted , the config tree is left with stale entries .
Hence to remove the stale entries for this use case , deleting all entries related to logicalSwitch upon
deleting L2gwConnecton.
*/
elanL2GatewayUtils.deleteElanMacsFromL2GatewayDevice(hwvtepNodeId.getValue(), logicalSwitchName);
InstanceIdentifier<LogicalSwitches> logicalSwitch = HwvtepSouthboundUtils
.createLogicalSwitchesInstanceIdentifier(hwvtepNodeId, new HwvtepNodeName(logicalSwitchName));
RemoteMcastMacsKey remoteMcastMacsKey = new RemoteMcastMacsKey(new HwvtepLogicalSwitchRef(logicalSwitch),
new MacAddress(ElanConstants.UNKNOWN_DMAC));
HwvtepUtils.deleteRemoteMcastMac(broker, hwvtepNodeId, remoteMcastMacsKey);
return futures;
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:DeleteLogicalSwitchJob.java
注:本文中的org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论