2 * Copyright (c) 2016 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.renderer.vpp.policy.acl;
11 import java.util.List;
12 import java.util.stream.Collectors;
14 import org.junit.Assert;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.groupbasedpolicy.renderer.vpp.policy.PolicyContext;
19 public class AccessListUtilTest extends TestResources {
21 private PolicyContext ctx;
25 ctx = super.createPolicyContext();
29 public void resolveAclsOnInterfaceTest() {
30 // TODO add more checking
31 List<AccessListWrapper> acls =
32 AccessListUtil.resolveAclsOnInterface(rendererEndpoint(l2AddrEp2).build().getKey(), ctx);
33 Assert.assertEquals(2, acls.size());
34 Assert.assertEquals(2, acls.stream().map(AccessListWrapper::getDirection).collect(Collectors.toSet()).size());
35 acls.stream().forEach(ace -> {
36 // allow peer + deny rest of tenant net + permit external
37 if (ace instanceof IngressAccessListWrapper) {
38 Assert.assertEquals(3, ace.readRules().size());
39 } else if (ace instanceof EgressAccessListWrapper) {
40 Assert.assertEquals(3, ace.readRules().size());