X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openstack%2Fnet-virt-providers%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fopenstack%2Fnetvirt%2Fproviders%2Fopenflow13%2Fservices%2FEgressAclServiceTest.java;h=c21b60fa0bbde363e34bdfde92fe71e68db7dfed;hb=98e1e29ca053b5b20903f8d068d3a286f36a0c8f;hp=f1654266de348eb4871d83069cd761787adf0617;hpb=a5f71c8ac13a86fe9c9b57068ce9784ba4fbe111;p=netvirt.git diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java index f1654266de..c21b60fa0b 100644 --- a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java +++ b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java @@ -266,6 +266,43 @@ public class EgressAclServiceTest { verify(commitFuture, times(1)).get(); } */ + /** + * Test method {@link EgressAclService#programPortSecurityGroup(java.lang.Long, java.lang.String, + * java.lang.String, long, org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup, + * java.lang.String, boolean)} when portSecurityRule is incomplete + */ + @Test + public void testProgramPortSecurityGroupWithIncompleteRule() throws Exception { + NeutronSecurityRule portSecurityRule1 = mock(NeutronSecurityRule.class); + when(portSecurityRule1.getSecurityRuleEthertype()).thenReturn("IPv4"); + when(portSecurityRule1.getSecurityRuleDirection()).thenReturn("not_egress"); // other direction + + NeutronSecurityRule portSecurityRule2 = mock(NeutronSecurityRule.class); + when(portSecurityRule2.getSecurityRuleEthertype()).thenReturn(null); + when(portSecurityRule2.getSecurityRuleDirection()).thenReturn("egress"); + + NeutronSecurityRule portSecurityRule3 = mock(NeutronSecurityRule.class); + when(portSecurityRule3.getSecurityRuleEthertype()).thenReturn("IPv4"); + when(portSecurityRule3.getSecurityRuleDirection()).thenReturn(null); + + NeutronSecurityRule portSecurityRule4 = mock(NeutronSecurityRule.class); + when(portSecurityRule4.getSecurityRuleEthertype()).thenReturn(null); + when(portSecurityRule4.getSecurityRuleDirection()).thenReturn(null); + + List portSecurityList = new ArrayList<>(); + portSecurityList.add(null); + portSecurityList.add(portSecurityRule1); + portSecurityList.add(portSecurityRule2); + portSecurityList.add(portSecurityRule3); + portSecurityList.add(portSecurityRule4); + + NeutronSecurityGroup localSecurityGroup = mock(NeutronSecurityGroup.class); + when(localSecurityGroup.getSecurityRules()).thenReturn(portSecurityList); + + egressAclServiceSpy.programPortSecurityGroup(DP_ID_LONG, SEGMENT_ID, MAC_ADDRESS, LOCAL_PORT, + localSecurityGroup, PORT_UUID, true); + } + /** * Test method {@link EgressAclService#egressACLDefaultTcpDrop(Long, String, String, int, boolean)} */