putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceCheck();
LOG.info("newInterface - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) -1);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_UNSPECIFIED, AclConstants.DEST_UPPER_PORT_UNSPECIFIED,
AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
dataBrokerUtil.put(
new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
.newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithEtherTypeAclCheck();
LOG.info("newInterfaceWithEtherTypeAcl - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) -1);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_UNSPECIFIED, AclConstants.DEST_UPPER_PORT_UNSPECIFIED,
AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
dataBrokerUtil.put(
new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
.newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithEtherTypeAclCheck();
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_1)
.newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_2)).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_2)
.newMatches(matches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
List<String> sgList = new ArrayList<>();
sgList.add(SG_UUID_1);
sgList.add(SG_UUID_2);
newAllowedAddressPair(PORT_1, sgList, Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, sgList, Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
newInterfaceWithMultipleAclCheck();
}
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
.newMatches(matches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithTcpDstAclCheck();
LOG.info("newInterfaceWithTcpDstAcl - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_UDP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
dataBrokerUtil.put(
new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
.newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithUdpDstAclCheck();
LOG.info("newInterfaceWithUdpDstAcl - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithIcmpAclCheck();
LOG.info("newInterfaceWithIcmpAcl - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 333, 777, AclConstants.SOURCE_REMOTE_IP_PREFIX_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 2000,
2003, AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
(short) NwConstants.IP_PROT_UDP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
.newMatches(matches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithDstPortRangeCheck();
LOG.info("newInterfaceWithDstPortRange - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 1, 65535, AclConstants.SOURCE_REMOTE_IP_PREFIX_UNSPECIFIED,
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 1,
65535, AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
(short) NwConstants.IP_PROT_UDP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
.newMatches(matches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithDstAllPortsCheck();
LOG.info("newInterfaceWithDstAllPorts - end");
newAllowedAddressPair(PORT_3, Arrays.asList(SG_UUID_1, SG_UUID_2), Collections.singletonList(AAP_PORT_3),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
Matches icmpEgressMatches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_2,
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(icmpEgressMatches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
.newMatches(icmpIngressMatches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_1)
.newMatches(icmpEgressMatches).newDirection(DirectionEgress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_2)
.newMatches(icmpIngressMatches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
// When
putNewStateInterface(dataBroker, PORT_3, PORT_MAC_3);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithTwoAclsHavingSameRulesCheck();
LOG.info("newInterfaceWithTwoAclsHavingSameRules - end");
public void newInterfaceWithIcmpAclHavingOverlappingMac() throws Exception {
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
// Given
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithIcmpAclCheck();
}
LOG.info("newInterfaceWithAapIpv4All test - start");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
List<AllowedAddressPairs> aapList = new ArrayList<>();
aapList.add(AAP_PORT_2);
aapList.add(buildAap("0.0.0.0/0", PORT_MAC_2));
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), aapList,
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithAapIpv4AllCheck();
LOG.info("newInterfaceWithAapIpv4All test - end");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1),
Arrays.asList(AAP_PORT_2, AAP_PORT_100, AAP_PORT_101), Collections.singletonList(SUBNET_INFO_1));
- asyncEventsWaiter.awaitEventsConsumption();
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
- asyncEventsWaiter.awaitEventsConsumption();
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
- asyncEventsWaiter.awaitEventsConsumption();
asyncEventsWaiter.awaitEventsConsumption();
- Thread.sleep(1000);
+
// Then
newInterfaceWithAapCheck();
LOG.info("newInterfaceWithAap test - end");
AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_ICMP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
.newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
- asyncEventsWaiter.awaitEventsConsumption();
matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
AclConstants.DEST_LOWER_PORT_2, AclConstants.DEST_UPPER_PORT_3,
(short) NwConstants.IP_PROT_ICMP);
dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
.newMatches(matches).newDirection(DirectionIngress.class).build());
- asyncEventsWaiter.awaitEventsConsumption();
}
protected void newAllowedAddressPair(String portName, List<String> sgUuidList, List<AllowedAddressPairs> aapList,