use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol in project netvirt by opendaylight.
the class NaptManager method removeFromIpPortMapDS.
protected void removeFromIpPortMapDS(long segmentId, String internalIpPort, NAPTEntryEvent.Protocol protocol) {
ProtocolTypes protocolType = NatUtil.getProtocolType(protocol);
removeFromIpPortMapDS(segmentId, internalIpPort, protocolType);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol in project netvirt by opendaylight.
the class AclServiceOFFlowBuilder method programIpFlow.
/**
* Converts IP matches into flows.
* @param matches
* the matches
* @return the map containing the flows and the respective flow id
*/
public static Map<String, List<MatchInfoBase>> programIpFlow(Matches matches) {
if (matches != null) {
AceIp acl = (AceIp) matches.getAceType();
Short protocol = acl.getProtocol();
if (protocol == null) {
return programEtherFlow(acl);
} else if (acl.getProtocol() == NwConstants.IP_PROT_TCP) {
return programTcpFlow(acl);
} else if (acl.getProtocol() == NwConstants.IP_PROT_UDP) {
return programUdpFlow(acl);
} else if (acl.getProtocol() == NwConstants.IP_PROT_ICMP) {
return programIcmpFlow(acl);
} else if (acl.getProtocol() != -1) {
return programOtherProtocolFlow(acl);
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol in project netvirt by opendaylight.
the class AclServiceOFFlowBuilder method programOtherProtocolFlow.
/**
* Converts generic protocol matches to flows.
*
* @param acl the access control list
* @return the map containing the flows and the respective flow id
*/
public static Map<String, List<MatchInfoBase>> programOtherProtocolFlow(AceIp acl) {
List<MatchInfoBase> flowMatches = new ArrayList<>();
flowMatches.addAll(addSrcIpMatches(acl));
flowMatches.addAll(addDstIpMatches(acl));
if (acl.getAceIpVersion() instanceof AceIpv4) {
flowMatches.add(MatchEthernetType.IPV4);
} else if (acl.getAceIpVersion() instanceof AceIpv6) {
flowMatches.add(MatchEthernetType.IPV6);
}
flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
String flowId = "OTHER_PROTO" + acl.getProtocol();
Map<String, List<MatchInfoBase>> flowMatchesMap = new HashMap<>();
flowMatchesMap.put(flowId, flowMatches);
return flowMatchesMap;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol in project netvirt by opendaylight.
the class AclServiceUtils method getHardTimoutForApplyStatefulChangeOnExistingTraffic.
/**
* Returns the hard timeout based on the protocol when a ACL rule removed from the instance.
* It will returns the timeout configured in the {@link AclserviceConfig} class.
*
* @param ace the ace
* @param aclServiceUtils acl service utils
* @return the hard time out
*/
public static Integer getHardTimoutForApplyStatefulChangeOnExistingTraffic(Ace ace, AclServiceUtils aclServiceUtils) {
int hardTimeout = AclConstants.SECURITY_GROUP_ICMP_IDLE_TIME_OUT;
Matches matches = ace.getMatches();
AceIp acl = (AceIp) matches.getAceType();
Short protocol = acl.getProtocol();
if (protocol == null) {
return hardTimeout;
} else if (protocol == NwConstants.IP_PROT_TCP) {
hardTimeout = aclServiceUtils.getConfig().getSecurityGroupTcpIdleTimeout();
} else if (protocol == NwConstants.IP_PROT_UDP) {
hardTimeout = aclServiceUtils.getConfig().getSecurityGroupUdpIdleTimeout();
}
return hardTimeout;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testProgramUdpFlow_NoSrcDstPortRange.
@Test
public void testProgramUdpFlow_NoSrcDstPortRange() {
AceIpBuilder builder = new AceIpBuilder();
AceIpv4Builder v4builder = new AceIpv4Builder();
v4builder.setSourceIpv4Network(new Ipv4Prefix("10.1.1.1/24"));
v4builder.setDestinationIpv4Network(new Ipv4Prefix("20.1.1.1/24"));
builder.setAceIpVersion(v4builder.build());
builder.setSourcePortRange(null);
builder.setDestinationPortRange(null);
short protocol = 1;
builder.setProtocol(protocol);
Map<String, List<MatchInfoBase>> flowMatchesMap = AclServiceOFFlowBuilder.programUdpFlow(builder.build());
List<MatchInfoBase> flowMatches = flowMatchesMap.get("UDP_SOURCE_ALL_");
AclServiceTestUtils.verifyGeneralFlows(flowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, NxMatchUdpSourcePort.class);
AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, NxMatchUdpDestinationPort.class);
}
Aggregations