2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.neutron.mapper.infrastructure;
11 import java.util.Collections;
12 import java.util.HashSet;
15 import javax.annotation.Nullable;
17 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
18 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
19 import org.opendaylight.groupbasedpolicy.api.sf.EtherTypeClassifierDefinition;
20 import org.opendaylight.groupbasedpolicy.api.sf.IpProtoClassifierDefinition;
21 import org.opendaylight.groupbasedpolicy.api.sf.L4ClassifierDefinition;
22 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.MappingUtils;
23 import org.opendaylight.groupbasedpolicy.util.IidFactory;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierName;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ContractId;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Description;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.EndpointGroupId;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Name;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.SubjectName;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.HasDirection.Direction;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.has.endpoint.identification.constraints.endpoint.identification.constraints.L3EndpointIdentificationConstraints;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.Contract;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroup;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.Clause;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.Subject;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.SubjectBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.clause.ConsumerMatchers;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.clause.ProviderMatchers;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.subject.Rule;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ConsumerNamedSelector;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ProviderNamedSelector;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ActionInstance;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ClassifierInstance;
47 import com.google.common.collect.ImmutableList;
49 public class NetworkService extends ServiceUtil {
52 * Unit tests {@link NetworkServiceTest}
55 private static final long DHCP_IPV4_SERVER_PORT = 67;
56 private static final long DHCP_IPV4_CLIENT_PORT = 68;
57 private static final long DHCP_IPV6_SERVER_PORT = 547;
58 private static final long DHCP_IPV6_CLIENT_PORT = 546;
59 private static final ClassifierName DHCP_IPV4_CLIENT_SERVER_NAME =
60 new ClassifierName("DHCP_IPv4_FROM_CLIENT_TO_SERVER");
61 private static final ClassifierName DHCP_IPV4_SERVER_CLIENT_NAME =
62 new ClassifierName("DHCP_IPv4_FROM_SERVER_TO_CLIENT");
63 private static final ClassifierName DHCP_IPV6_CLIENT_SERVER_NAME =
64 new ClassifierName("DHCP_IPv6_FROM_CLIENT_TO_SERVER");
65 private static final ClassifierName DHCP_IPV6_SERVER_CLIENT_NAME =
66 new ClassifierName("DHCP_IPv6_FROM_SERVER_TO_CLIENT");
67 private static final SubjectName DHCP_SUBJECT_NAME = new SubjectName("ALLOW_DHCP");
68 private static final Description DHCP_CONTRACT_DESC =
69 new Description("Allow DHCP communication between client and server.");
72 * Id of {@link #DHCP_CONTRACT}
74 public static final ContractId DHCP_CONTRACT_ID = new ContractId("11118d2e-dddd-11e5-885d-feff819cdc9f");
76 * Contains rules with action {@link MappingUtils#ACTION_REF_ALLOW} matching DHCP communication
77 * between Client and Server.
79 public static final Contract DHCP_CONTRACT;
81 * {@link ConsumerNamedSelector} pointing to {@link #DHCP_CONTRACT}
83 public static final ConsumerNamedSelector DHCP_CONTRACT_CONSUMER_SELECTOR;
86 private static final long DNS_SERVER_PORT = 53;
87 private static final ClassifierName DNS_UDP_IPV4_CLIENT_SERVER_NAME =
88 new ClassifierName("DNS_UDP_IPv4_FROM_CLIENT_TO_SERVER");
89 private static final ClassifierName DNS_UDP_IPV4_SERVER_CLIENT_NAME =
90 new ClassifierName("DNS_UDP_IPv4_FROM_SERVER_TO_CLIENT");
91 private static final ClassifierName DNS_UDP_IPV6_CLIENT_SERVER_NAME =
92 new ClassifierName("DNS_UDP_IPv6_FROM_CLIENT_TO_SERVER");
93 private static final ClassifierName DNS_UDP_IPV6_SERVER_CLIENT_NAME =
94 new ClassifierName("DNS_UDP_IPv6_FROM_SERVER_TO_CLIENT");
95 private static final ClassifierName DNS_TCP_IPV4_CLIENT_SERVER_NAME =
96 new ClassifierName("DNS_TCP_IPv4_FROM_CLIENT_TO_SERVER");
97 private static final ClassifierName DNS_TCP_IPV4_SERVER_CLIENT_NAME =
98 new ClassifierName("DNS_TCP_IPv4_FROM_SERVER_TO_CLIENT");
99 private static final ClassifierName DNS_TCP_IPV6_CLIENT_SERVER_NAME =
100 new ClassifierName("DNS_TCP_IPv6_FROM_CLIENT_TO_SERVER");
101 private static final ClassifierName DNS_TCP_IPV6_SERVER_CLIENT_NAME =
102 new ClassifierName("DNS_TCP_IPv6_FROM_SERVER_TO_CLIENT");
103 private static final SubjectName DNS_SUBJECT_NAME = new SubjectName("ALLOW_DNS");
104 private static final Description DNS_CONTRACT_DESC =
105 new Description("Allow DNS communication between client and server.");
107 * ID of {@link #DNS_CONTRACT}
109 public static final ContractId DNS_CONTRACT_ID = new ContractId("22218d2e-dddd-11e5-885d-feff819cdc9f");
111 * Contains rules with action {@link MappingUtils#ACTION_REF_ALLOW} matching DNS communication
112 * between Client and Server.
114 public static final Contract DNS_CONTRACT;
116 * {@link ConsumerNamedSelector} pointing to {@link #DNS_CONTRACT}
118 public static final ConsumerNamedSelector DNS_CONTRACT_CONSUMER_SELECTOR;
120 // ########### SSH and ICMP management
121 private static final long SSH_TCP_PORT = 22;
122 private static final ClassifierName SSH_IPV4_SERVER_TO_CLIENT_NAME =
123 new ClassifierName("SSH_IPV4_FROM_SERVER_TO_CLIENT");
124 private static final ClassifierName SSH_IPV6_SERVER_TO_CLIENT_NAME =
125 new ClassifierName("SSH_IPV6_FROM_SERVER_TO_CLIENT");
126 private static final ClassifierName SSH_IPV4_CLIENT_TO_SERVER_NAME =
127 new ClassifierName("SSH_IPV4_FROM_CLIENT_TO_SERVER");
128 private static final ClassifierName SSH_IPV6_CLIENT_TO_SERVER_NAME =
129 new ClassifierName("SSH_IPV6_FROM_CLIENT_TO_SERVER");
130 private static final ClassifierName ICMP_IPV4_BETWEEN_SERVER_CLIENT_NAME =
131 new ClassifierName("ICMP_IPV4_BETWEEN_SERVER_CLIENT");
132 private static final ClassifierName ICMP_IPV6_BETWEEN_SERVER_CLIENT_NAME =
133 new ClassifierName("ICMP_IPV6_BETWEEN_SERVER_CLIENT");
134 private static final SubjectName MGMT_SUBJECT_NAME = new SubjectName("ALLOW_MGMT");
135 private static final Description MGMT_CONTRACT_DESC =
136 new Description("Allow ICMP and SSH management communication between server and client.");
139 * Id of {@link #MGMT_CONTRACT}
141 public static final ContractId MGMT_CONTRACT_ID = new ContractId("33318d2e-dddd-11e5-885d-feff819cdc9f");
143 * Contains rules with action {@link MappingUtils#ACTION_REF_ALLOW} matching ICMP and SSH
145 * between Client and Server.
147 public static final Contract MGMT_CONTRACT;
149 * {@link ConsumerNamedSelector} pointing to {@link #MGMT_CONTRACT}
151 public static final ConsumerNamedSelector MGMT_CONTRACT_CONSUMER_SELECTOR;
153 // ########### NETWORK-SERVICE ENDPOINT-GROUP
154 private static final Name NETWORK_SERVICE_EPG_NAME = new Name("NETWORK_SERVICE");
155 private static final Description NETWORK_SERVICE_EPG_DESC = new Description("Represents DHCP and DNS servers.");
159 public static final EndpointGroupId EPG_ID = new EndpointGroupId("ddd6cfe6-dfe5-11e4-8a00-1681e6b88ec1");
161 * Network-service endpoint-group providing {@link #DHCP_CONTRACT} and {@link #DNS_CONTRACT}
163 public static final EndpointGroup EPG;
166 DHCP_CONTRACT = createContractDhcp();
167 DHCP_CONTRACT_CONSUMER_SELECTOR = createConsumerSelector(DHCP_CONTRACT);
168 DNS_CONTRACT = createContractDns();
169 DNS_CONTRACT_CONSUMER_SELECTOR = createConsumerSelector(DNS_CONTRACT);
170 MGMT_CONTRACT = createContractMgmt();
171 MGMT_CONTRACT_CONSUMER_SELECTOR = createConsumerSelector(MGMT_CONTRACT);
172 EPG = createNetworkServiceEpg();
175 private static EndpointGroup createNetworkServiceEpg() {
176 ProviderNamedSelector dhcpProviderSelector = createProviderSelector(DHCP_CONTRACT);
177 ProviderNamedSelector dnsProviderSelector = createProviderSelector(DNS_CONTRACT);
178 ProviderNamedSelector mgmtProviderSelector = createProviderSelector(MGMT_CONTRACT);
179 return createEpgBuilder(EPG_ID, NETWORK_SERVICE_EPG_NAME, NETWORK_SERVICE_EPG_DESC)
180 .setProviderNamedSelector(ImmutableList.of(dhcpProviderSelector, dnsProviderSelector, mgmtProviderSelector))
184 private static Contract createContractDhcp() {
185 Rule clientServerIpv4Rule = createRuleAllow(DHCP_IPV4_CLIENT_SERVER_NAME, Direction.In);
186 Rule serverClientIpv4Rule = createRuleAllow(DHCP_IPV4_SERVER_CLIENT_NAME, Direction.Out);
187 Rule clientServerIpv6Rule = createRuleAllow(DHCP_IPV6_CLIENT_SERVER_NAME, Direction.In);
188 Rule serverClientIpv6Rule = createRuleAllow(DHCP_IPV6_SERVER_CLIENT_NAME, Direction.Out);
189 Subject subject = new SubjectBuilder().setName(DHCP_SUBJECT_NAME)
191 .setRule(ImmutableList.of(clientServerIpv4Rule, serverClientIpv4Rule, clientServerIpv6Rule,
192 serverClientIpv6Rule))
194 return createContract(DHCP_CONTRACT_ID, ImmutableList.of(subject), DHCP_CONTRACT_DESC);
197 private static Contract createContractDns() {
198 Rule clientServerUdpIpv4Rule = createRuleAllow(DNS_UDP_IPV4_CLIENT_SERVER_NAME, Direction.In);
199 Rule serverClientUdpIpv4Rule = createRuleAllow(DNS_UDP_IPV4_SERVER_CLIENT_NAME, Direction.Out);
200 Rule clientServerUdpIpv6Rule = createRuleAllow(DNS_UDP_IPV6_CLIENT_SERVER_NAME, Direction.In);
201 Rule serverClientUdpIpv6Rule = createRuleAllow(DNS_UDP_IPV6_SERVER_CLIENT_NAME, Direction.Out);
202 Rule clientServerTcpIpv4Rule = createRuleAllow(DNS_TCP_IPV4_CLIENT_SERVER_NAME, Direction.In);
203 Rule serverClientTcpIpv4Rule = createRuleAllow(DNS_TCP_IPV4_SERVER_CLIENT_NAME, Direction.Out);
204 Rule clientServerTcpIpv6Rule = createRuleAllow(DNS_TCP_IPV6_CLIENT_SERVER_NAME, Direction.In);
205 Rule serverClientTcpIpv6Rule = createRuleAllow(DNS_TCP_IPV6_SERVER_CLIENT_NAME, Direction.Out);
206 Subject subject = new SubjectBuilder().setName(DNS_SUBJECT_NAME)
208 .setRule(ImmutableList.of(clientServerUdpIpv4Rule, serverClientUdpIpv4Rule, clientServerUdpIpv6Rule,
209 serverClientUdpIpv6Rule, clientServerTcpIpv4Rule, serverClientTcpIpv4Rule, clientServerTcpIpv6Rule,
210 serverClientTcpIpv6Rule))
212 return createContract(DNS_CONTRACT_ID, ImmutableList.of(subject), DNS_CONTRACT_DESC);
215 private static Contract createContractMgmt() {
216 Rule serverClientSshIpv4Rule = createRuleAllow(SSH_IPV4_SERVER_TO_CLIENT_NAME, Direction.Out);
217 Rule serverClientSshIpv6Rule = createRuleAllow(SSH_IPV6_SERVER_TO_CLIENT_NAME, Direction.Out);
218 Rule clientServerSshIpv4Rule = createRuleAllow(SSH_IPV4_CLIENT_TO_SERVER_NAME, Direction.In);
219 Rule clientServerSshIpv6Rule = createRuleAllow(SSH_IPV6_CLIENT_TO_SERVER_NAME, Direction.In);
220 Rule serverClientIcmpIpv4Rule = createRuleAllow(ICMP_IPV4_BETWEEN_SERVER_CLIENT_NAME, Direction.Out);
221 Rule serverClientIcmpIpv6Rule = createRuleAllow(ICMP_IPV6_BETWEEN_SERVER_CLIENT_NAME, Direction.Out);
222 Rule clientServerIcmpIpv4Rule = createRuleAllow(ICMP_IPV4_BETWEEN_SERVER_CLIENT_NAME, Direction.In);
223 Rule clientServerIcmpIpv6Rule = createRuleAllow(ICMP_IPV6_BETWEEN_SERVER_CLIENT_NAME, Direction.In);
225 Subject subject = new SubjectBuilder().setName(MGMT_SUBJECT_NAME)
227 .setRule(ImmutableList.of(serverClientSshIpv4Rule, serverClientSshIpv6Rule, clientServerSshIpv4Rule,
228 clientServerSshIpv6Rule, clientServerIcmpIpv4Rule, clientServerIcmpIpv6Rule,
229 serverClientIcmpIpv4Rule, serverClientIcmpIpv6Rule))
231 return createContract(MGMT_CONTRACT_ID, ImmutableList.of(subject), MGMT_CONTRACT_DESC);
235 * puts clause with {@link L3EndpointIdentificationConstraints} in {@link ConsumerMatchers}
236 * and {@link ProviderMatchers}. This clause points to subject in {@link #DHCP_CONTRACT}.
238 * @param tenantId location of {@link #DHCP_CONTRACT}
239 * @param ipPrefix used in {@link L3EndpointIdentificationConstraints}
240 * @param wTx transaction where entities are written
242 public static void writeDhcpClauseWithConsProvEic(TenantId tenantId, @Nullable IpPrefix ipPrefix,
243 WriteTransaction wTx) {
244 Clause clause = createClauseWithConsProvEic(ipPrefix, DHCP_SUBJECT_NAME);
245 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.clauseIid(tenantId, DHCP_CONTRACT_ID, clause.getName()),
250 * puts clause with {@link L3EndpointIdentificationConstraints} in {@link ConsumerMatchers}
251 * and {@link ProviderMatchers}. This clause points to subject in {@link #DNS_CONTRACT}.
253 * @param tenantId location of {@link #DNS_CONTRACT}
254 * @param ipPrefix used in {@link L3EndpointIdentificationConstraints}
255 * @param wTx transaction where entities are written
257 public static void writeDnsClauseWithConsProvEic(TenantId tenantId, @Nullable IpPrefix ipPrefix,
258 WriteTransaction wTx) {
259 Clause clause = createClauseWithConsProvEic(ipPrefix, DNS_SUBJECT_NAME);
260 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.clauseIid(tenantId, DNS_CONTRACT_ID, clause.getName()),
265 * puts clause with {@link L3EndpointIdentificationConstraints} in {@link ConsumerMatchers}
266 * and {@link ProviderMatchers}. This clause points to subject in {@link #MGMT_CONTRACT}.
268 * @param tenantId location of {@link #MGMT_CONTRACT}
269 * @param ipPrefix used in {@link L3EndpointIdentificationConstraints}
270 * @param wTx transaction where entities are written
272 public static void writeMgmtClauseWithConsProvEic(TenantId tenantId, @Nullable IpPrefix ipPrefix,
273 WriteTransaction wTx) {
274 Clause clause = createClauseWithConsProvEic(ipPrefix, MGMT_SUBJECT_NAME);
275 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.clauseIid(tenantId, MGMT_CONTRACT_ID, clause.getName()),
280 * Puts network service entities (classifier-instances, {@link #DHCP_CONTRACT},
281 * {@link #DNS_CONTRACT}, {@link #MGMT_CONTRACT} and {@link #EPG}) to
282 * {@link LogicalDatastoreType#CONFIGURATION}
284 * @param tenantId location of network-service entities
285 * @param wTx transaction where network-service entities are written
287 public static void writeNetworkServiceEntitiesToTenant(TenantId tenantId, WriteTransaction wTx) {
288 Set<ClassifierInstance> classifierInstances = getAllClassifierInstances();
289 for (ClassifierInstance ci : classifierInstances) {
290 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.classifierInstanceIid(tenantId, ci.getName()), ci,
293 for (ActionInstance ai : Collections.singleton(MappingUtils.ACTION_ALLOW)) {
294 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.actionInstanceIid(tenantId, ai.getName()), ai, true);
296 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.contractIid(tenantId, DHCP_CONTRACT_ID), DHCP_CONTRACT,
298 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.contractIid(tenantId, DNS_CONTRACT_ID), DNS_CONTRACT,
300 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.contractIid(tenantId, MGMT_CONTRACT_ID), MGMT_CONTRACT,
302 wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.endpointGroupIid(tenantId, EPG_ID), EPG, true);
306 * @return All classifier-instances used in {@link #DHCP_CONTRACT}, {@link #DNS_CONTRACT} and
307 * {@link #MGMT_CONTRACT}
309 public static Set<ClassifierInstance> getAllClassifierInstances() {
310 HashSet<ClassifierInstance> cis = new HashSet<>();
311 cis.add(createDhcpIpv4ClientServer());
312 cis.add(createDhcpIpv4ServerClient());
313 cis.add(createDhcpIpv6ClientServer());
314 cis.add(createDhcpIpv6ServerClient());
315 cis.add(createDnsUdpIpv4ClientServer());
316 cis.add(createDnsUdpIpv4ServerClient());
317 cis.add(createDnsUdpIpv6ClientServer());
318 cis.add(createDnsUdpIpv6ServerClient());
319 cis.add(createDnsTcpIpv4ClientServer());
320 cis.add(createDnsTcpIpv4ServerClient());
321 cis.add(createDnsTcpIpv6ClientServer());
322 cis.add(createDnsTcpIpv6ServerClient());
324 cis.add(createSshTcpIpv4ServerClient());
325 cis.add(createSshTcpIpv6ServerClient());
326 cis.add(createSshTcpIpv4ClientServer());
327 cis.add(createSshTcpIpv6ClientServer());
328 cis.add(createIcmpIpv4());
329 cis.add(createIcmpIpv6());
333 // ###################### DHCP
334 private static ClassifierInstance createDhcpIpv4ClientServer() {
335 return createClassifInstance(DHCP_IPV4_CLIENT_SERVER_NAME, L4ClassifierDefinition.DEFINITION.getId(),
336 createParams(EtherTypeClassifierDefinition.IPv4_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
337 DHCP_IPV4_CLIENT_PORT, DHCP_IPV4_SERVER_PORT));
340 private static ClassifierInstance createDhcpIpv4ServerClient() {
341 return createClassifInstance(DHCP_IPV4_SERVER_CLIENT_NAME, L4ClassifierDefinition.DEFINITION.getId(),
342 createParams(EtherTypeClassifierDefinition.IPv4_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
343 DHCP_IPV4_SERVER_PORT, DHCP_IPV4_CLIENT_PORT));
346 private static ClassifierInstance createDhcpIpv6ClientServer() {
347 return createClassifInstance(DHCP_IPV6_CLIENT_SERVER_NAME, L4ClassifierDefinition.DEFINITION.getId(),
348 createParams(EtherTypeClassifierDefinition.IPv6_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
349 DHCP_IPV6_CLIENT_PORT, DHCP_IPV6_SERVER_PORT));
352 private static ClassifierInstance createDhcpIpv6ServerClient() {
353 return createClassifInstance(DHCP_IPV6_SERVER_CLIENT_NAME, L4ClassifierDefinition.DEFINITION.getId(),
354 createParams(EtherTypeClassifierDefinition.IPv6_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
355 DHCP_IPV6_SERVER_PORT, DHCP_IPV6_CLIENT_PORT));
358 // ###################### DNS UDP
359 private static ClassifierInstance createDnsUdpIpv4ClientServer() {
360 return createClassifInstance(DNS_UDP_IPV4_CLIENT_SERVER_NAME, L4ClassifierDefinition.DEFINITION.getId(),
361 createParams(EtherTypeClassifierDefinition.IPv4_VALUE, IpProtoClassifierDefinition.UDP_VALUE, null,
365 private static ClassifierInstance createDnsUdpIpv4ServerClient() {
366 return createClassifInstance(DNS_UDP_IPV4_SERVER_CLIENT_NAME, L4ClassifierDefinition.DEFINITION.getId(),
367 createParams(EtherTypeClassifierDefinition.IPv4_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
368 DNS_SERVER_PORT, null));
371 private static ClassifierInstance createDnsUdpIpv6ClientServer() {
372 return createClassifInstance(DNS_UDP_IPV6_CLIENT_SERVER_NAME, L4ClassifierDefinition.DEFINITION.getId(),
373 createParams(EtherTypeClassifierDefinition.IPv6_VALUE, IpProtoClassifierDefinition.UDP_VALUE, null,
377 private static ClassifierInstance createDnsUdpIpv6ServerClient() {
378 return createClassifInstance(DNS_UDP_IPV6_SERVER_CLIENT_NAME, L4ClassifierDefinition.DEFINITION.getId(),
379 createParams(EtherTypeClassifierDefinition.IPv6_VALUE, IpProtoClassifierDefinition.UDP_VALUE,
380 DNS_SERVER_PORT, null));
383 // ###################### DNS TCP
384 private static ClassifierInstance createDnsTcpIpv4ClientServer() {
385 return createClassifInstance(DNS_TCP_IPV4_CLIENT_SERVER_NAME,
386 L4ClassifierDefinition.DEFINITION.getId(),
387 createParams(EtherTypeClassifierDefinition.IPv4_VALUE,
388 IpProtoClassifierDefinition.TCP_VALUE, null, DNS_SERVER_PORT));
391 private static ClassifierInstance createDnsTcpIpv4ServerClient() {
392 return createClassifInstance(DNS_TCP_IPV4_SERVER_CLIENT_NAME,
393 L4ClassifierDefinition.DEFINITION.getId(),
394 createParams(EtherTypeClassifierDefinition.IPv4_VALUE,
395 IpProtoClassifierDefinition.TCP_VALUE, DNS_SERVER_PORT, null));
398 private static ClassifierInstance createDnsTcpIpv6ClientServer() {
399 return createClassifInstance(DNS_TCP_IPV6_CLIENT_SERVER_NAME,
400 L4ClassifierDefinition.DEFINITION.getId(),
401 createParams(EtherTypeClassifierDefinition.IPv6_VALUE,
402 IpProtoClassifierDefinition.TCP_VALUE, null, DNS_SERVER_PORT));
405 private static ClassifierInstance createDnsTcpIpv6ServerClient() {
406 return createClassifInstance(DNS_TCP_IPV6_SERVER_CLIENT_NAME,
407 L4ClassifierDefinition.DEFINITION.getId(),
408 createParams(EtherTypeClassifierDefinition.IPv6_VALUE,
409 IpProtoClassifierDefinition.TCP_VALUE, DNS_SERVER_PORT, null));
412 // ###################### SSH TCP
413 private static ClassifierInstance createSshTcpIpv4ClientServer() {
414 return createClassifInstance(SSH_IPV4_CLIENT_TO_SERVER_NAME,
415 L4ClassifierDefinition.DEFINITION.getId(),
416 createParams(EtherTypeClassifierDefinition.IPv4_VALUE,
417 IpProtoClassifierDefinition.TCP_VALUE, SSH_TCP_PORT, null));
420 private static ClassifierInstance createSshTcpIpv4ServerClient() {
421 return createClassifInstance(SSH_IPV4_SERVER_TO_CLIENT_NAME,
422 L4ClassifierDefinition.DEFINITION.getId(),
423 createParams(EtherTypeClassifierDefinition.IPv4_VALUE,
424 IpProtoClassifierDefinition.TCP_VALUE, null, SSH_TCP_PORT));
427 private static ClassifierInstance createSshTcpIpv6ClientServer() {
428 return createClassifInstance(SSH_IPV6_CLIENT_TO_SERVER_NAME,
429 L4ClassifierDefinition.DEFINITION.getId(),
430 createParams(EtherTypeClassifierDefinition.IPv6_VALUE,
431 IpProtoClassifierDefinition.TCP_VALUE, SSH_TCP_PORT, null));
434 private static ClassifierInstance createSshTcpIpv6ServerClient() {
435 return createClassifInstance(SSH_IPV6_SERVER_TO_CLIENT_NAME,
436 L4ClassifierDefinition.DEFINITION.getId(),
437 createParams(EtherTypeClassifierDefinition.IPv6_VALUE,
438 IpProtoClassifierDefinition.TCP_VALUE, null, SSH_TCP_PORT));
441 // ###################### ICMP
442 private static ClassifierInstance createIcmpIpv4() {
443 return createClassifInstance(ICMP_IPV4_BETWEEN_SERVER_CLIENT_NAME,
444 IpProtoClassifierDefinition.DEFINITION.getId(), createParams(
445 EtherTypeClassifierDefinition.IPv4_VALUE, IpProtoClassifierDefinition.ICMP_VALUE, null, null));
448 private static ClassifierInstance createIcmpIpv6() {
449 return createClassifInstance((ICMP_IPV6_BETWEEN_SERVER_CLIENT_NAME),
450 IpProtoClassifierDefinition.DEFINITION.getId(), createParams(
451 EtherTypeClassifierDefinition.IPv6_VALUE, IpProtoClassifierDefinition.ICMP_VALUE, null, null));