use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId in project netvirt by opendaylight.
the class PolicyAceFlowProgrammer method getIngressInterfaceFlow.
private Optional<PolicyAceFlowWrapper> getIngressInterfaceFlow(IngressInterface ingressInterface) {
String interfaceName = ingressInterface.getName();
if (interfaceName == null) {
LOG.error("Invalid ingress interface augmentation. missing interface name");
return Optional.absent();
}
String flowName = "INGRESS_INTERFACE_" + interfaceName;
int flowPriority = PolicyServiceConstants.POLICY_ACL_TRUNK_INTERFACE_FLOW_PRIOPITY;
VlanId vlanId = ingressInterface.getVlanId();
if (vlanId != null) {
Optional<String> vlanMemberInterfaceOpt = policyServiceUtil.getVlanMemberInterface(interfaceName, vlanId);
if (!vlanMemberInterfaceOpt.isPresent()) {
LOG.debug("Vlan member {} missing for trunk {}", vlanId.getValue(), interfaceName);
return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
}
interfaceName = vlanMemberInterfaceOpt.get();
flowPriority = PolicyServiceConstants.POLICY_ACL_VLAN_INTERFACE_FLOW_PRIOPITY;
}
List<MatchInfoBase> matches = policyFlowUtil.getIngressInterfaceMatches(interfaceName);
if (matches == null || matches.isEmpty()) {
LOG.debug("Failed to get ingress interface {} matches", interfaceName);
return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
}
BigInteger dpId = interfaceManager.getDpnForInterface(interfaceName);
if (dpId == null) {
dpId = BigInteger.ZERO;
}
return Optional.of(new PolicyAceFlowWrapper(flowName, matches, flowPriority, dpId));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId in project openflowplugin by opendaylight.
the class FlowConvertor method isSetVlanIdActionCasePresent.
// check if set vlanid action is present in the flow
private static boolean isSetVlanIdActionCasePresent(Flow flow) {
// If yes,then we would need to two flows
if (flow.getInstructions() != null && flow.getInstructions().getInstruction() != null) {
for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : flow.getInstructions().getInstruction()) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction.getInstruction();
if (curInstruction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase applyActionscase = (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) curInstruction;
ApplyActions applyActions = applyActionscase.getApplyActions();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : applyActions.getAction()) {
if (action.getAction() instanceof SetVlanIdActionCase) {
return true;
}
}
}
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId in project genius by opendaylight.
the class FlowBasedServicesUtils method getMatchInfoForVlanPortAtIngressTable.
public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchInPort(dpId, portNo));
int vlanId = 0;
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan != null) {
vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
}
if (vlanId >= 0 && l2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Transparent) {
matches.add(new MatchVlanVid(vlanId));
}
return matches;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId in project genius by opendaylight.
the class TepCommandHelperTest method testCreateLocalCacheWithoutcheckExistingSubnet.
@Test
public void testCreateLocalCacheWithoutcheckExistingSubnet() {
IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
IpPrefix subnetMaskObj = ipPrefixTest;
SubnetsKey subnetsKey = new SubnetsKey(subnetMaskObj);
SubnetObject subObCli = new SubnetObject(gatewayIpObj, subnetsKey, subnetMaskObj, vlanId);
Map<SubnetObject, List<Vteps>> subVtepMapTemp = new HashMap<>();
subVtepMapTemp.put(subObCli, vtepsList);
transportZoneNew = new TransportZoneBuilder().setZoneName(transportZone1).setTunnelType(tunnelType2).build();
doReturn(Futures.immediateCheckedFuture(Optional.of(transportZoneNew))).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
try {
tepCommandHelper.createLocalCache(dpId1, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
tepCommandHelper.createLocalCache(dpId2, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
} catch (TepException e) {
LOG.error(e.getMessage());
}
verify(mockReadTx, times(2)).read(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId in project genius by opendaylight.
the class TepCommandHelperTest method testDeleteOnCommit.
@Test
public void testDeleteOnCommit() {
transportZoneList.add(transportZone);
transportZoneList.add(transportZoneNew);
transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
optionalTransportZones = Optional.of(transportZones);
doReturn(Futures.immediateCheckedFuture(optionalTransportZones)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
try {
tepCommandHelper.deleteVtep(dpId1, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
} catch (TepException e) {
LOG.error(e.getMessage());
}
tepCommandHelper.deleteOnCommit();
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, vtepsIdentifier);
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, subnetsIdentifier);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, vtepsIdentifierNew);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, subnetsIdentifier);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
}
Aggregations