本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java MacAddress.getValue方法的具体用法?Java MacAddress.getValue怎么用?Java MacAddress.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress
的用法示例。
在下文中一共展示了MacAddress.getValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: pushFlowsByMacAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入方法依赖的package包/类
private void pushFlowsByMacAddress(final MacAddress srcMacAddress, final MacAddress dstMacAddress,
final NodeId nodeId, final FlowAction flowAction) {
final MatchBuilder matchBuilder = MatchUtils.createEthMatch(new MatchBuilder(), srcMacAddress, dstMacAddress);
final String flowIdStr = srcMacAddress.getValue() + "_" + dstMacAddress.getValue();
final FlowBuilder flowBuilder = createFlowBuilder(matchBuilder, new FlowId(flowIdStr));
// TODO: Extend for other actions
if (action instanceof Allow) {
// Set allow action
Instructions buildedInstructions = createOutputInstructions(OutputPortValues.NORMAL);
flowBuilder.setInstructions(buildedInstructions);
} else {
String actionClass = action.getClass().getName();
LOG.error("Invalid action: {}", actionClass);
}
writeDataTransaction(nodeId, flowBuilder, flowAction);
}
示例8: unInstallL2GwUcastMacFromElan
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入方法依赖的package包/类
/**
* Un install l2 gw ucast mac from elan.
*
* @param elan
* the elan
* @param l2GwDevice
* the l2 gw device
* @param macAddresses
* the mac addresses
*/
public void unInstallL2GwUcastMacFromElan(final ElanInstance elan, final L2GatewayDevice l2GwDevice,
final List<MacAddress> macAddresses) {
if (macAddresses == null || macAddresses.isEmpty()) {
return;
}
final String elanName = elan.getElanInstanceName();
final List<DpnInterfaces> elanDpns = getElanDpns(elanName);
// Retrieve all participating DPNs in this Elan. Populate this MAC in
// DMAC table. Looping through all DPNs in order to add/remove mac flows
// in their DMAC table
for (final MacAddress mac : macAddresses) {
if (!elanDpns.isEmpty()) {
String jobKey = elanName + ":" + mac.getValue();
elanClusterUtils.runOnlyInOwnerNode(jobKey, "delete l2gw macs from dmac table", () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>();
for (DpnInterfaces elanDpn : elanDpns) {
BigInteger dpnId = elanDpn.getDpId();
// This delete operation has been batched using resource batch manager.
futures.addAll(elanDmacUtils.deleteDmacFlowsToExternalMac(elan.getElanTag(), dpnId,
l2GwDevice.getHwvtepNodeId(), mac.getValue().toLowerCase()));
}
return futures;
});
}
}
//Batched job
DeleteL2GwDeviceMacsFromElanJob job = new DeleteL2GwDeviceMacsFromElanJob(elanName, l2GwDevice,
macAddresses);
elanClusterUtils.runOnlyInOwnerNode(job.getJobKey(), "delete remote ucast macs in l2gw devices", job);
}
示例9: deleteElanL2GwDevicesUcastLocalMacsFromDpn
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入方法依赖的package包/类
/**
* Delete elan l2 gateway devices ucast local macs from dpn.
*
* @param elanName
* the elan name
* @param dpnId
* the dpn id
*/
public void deleteElanL2GwDevicesUcastLocalMacsFromDpn(final String elanName, final BigInteger dpnId) {
ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName);
if (elanL2GwDevices == null || elanL2GwDevices.isEmpty()) {
LOG.trace("No L2 gateway devices in Elan [{}] cache.", elanName);
return;
}
final ElanInstance elan = ElanUtils.getElanInstanceByName(broker, elanName);
if (elan == null) {
LOG.error("Could not find Elan by name: {}", elanName);
return;
}
LOG.info("Deleting Elan [{}] L2GatewayDevices UcastLocalMacs from Dpn [{}]", elanName, dpnId);
final Long elanTag = elan.getElanTag();
for (final L2GatewayDevice l2GwDevice : elanL2GwDevices.values()) {
List<MacAddress> localMacs = getL2GwDeviceLocalMacs(l2GwDevice);
if (localMacs != null && !localMacs.isEmpty()) {
for (final MacAddress mac : localMacs) {
String jobKey = elanName + ":" + mac.getValue();
elanClusterUtils.runOnlyInOwnerNode(jobKey,
() -> elanDmacUtils.deleteDmacFlowsToExternalMac(elanTag, dpnId,
l2GwDevice.getHwvtepNodeId(), mac.getValue()));
}
}
}
}
示例10: convertToYang130715MacAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; //导入方法依赖的package包/类
public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress convertToYang130715MacAddress(
MacAddress ulnMac) {
return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress(
ulnMac.getValue());
}