diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/ACL.java b/src/main/java/net/floodlightcontroller/accesscontrollist/ACL.java index 9ad256429d4e759609a7b0be60d52cf6c85801c5..9f2b76bc9a0e05ed4cef5be34e3e98bf31919ba6 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/ACL.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/ACL.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import java.util.ArrayList; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/ACLRule.java b/src/main/java/net/floodlightcontroller/accesscontrollist/ACLRule.java index f77c4a19d89b9b67a121d8d6f154412469d5fe67..57d0c5f006eff6dd2eb8266d6bc59694e623caa3 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/ACLRule.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/ACLRule.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static net.floodlightcontroller.accesscontrollist.util.IPAddressUtil.isSubnet; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/FlowPusher.java b/src/main/java/net/floodlightcontroller/accesscontrollist/FlowPusher.java index 4d8212aa4f339f336b4b92d201d249d31093544c..34f97589b346a869fbc408b7f32c43a70b435011 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/FlowPusher.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/FlowPusher.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import java.util.ArrayList; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/IACLService.java b/src/main/java/net/floodlightcontroller/accesscontrollist/IACLService.java index 6dba875d4163fdb625ae894e76e17d2d0a8362ed..07b0026587de176475445e22c264f28c7368e275 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/IACLService.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/IACLService.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import java.util.List; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/ap/AP.java b/src/main/java/net/floodlightcontroller/accesscontrollist/ap/AP.java index 97a3293c3f4190833a6576781125f92d560d5361..eb44f0ce43367a60c3a8fcd8aacaf6be262a788e 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/ap/AP.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/ap/AP.java @@ -1,10 +1,22 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.ap; -/** - * Accessing Pair (AP) - * @author Alex - * - */ public class AP { private String ip; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/ap/APManager.java b/src/main/java/net/floodlightcontroller/accesscontrollist/ap/APManager.java index 2a3afdeee5ace1e9c8a0ce3a2633100f1b1cd70a..7fbd463adcba1753b1008f1a7ad7e9983a1d34e5 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/ap/APManager.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/ap/APManager.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.ap; import java.util.HashSet; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleResourceTest.java b/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleResourceTest.java deleted file mode 100644 index 90e244f5abdf07cd7ae1c61e99744cf797bfc451..0000000000000000000000000000000000000000 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleResourceTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package net.floodlightcontroller.accesscontrollist.test; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import net.floodlightcontroller.accesscontrollist.ACL; -import net.floodlightcontroller.accesscontrollist.ACLRule; -import net.floodlightcontroller.accesscontrollist.IACLService; -import net.floodlightcontroller.accesscontrollist.util.IPAddressUtil; -import net.floodlightcontroller.accesscontrollist.web.ACLRuleResource; -import net.floodlightcontroller.core.module.FloodlightModuleContext; -import net.floodlightcontroller.core.module.FloodlightModuleException; -import net.floodlightcontroller.test.FloodlightTestCase; - -import org.junit.Test; -import org.restlet.Context; - -public class ACLRuleResourceTest extends FloodlightTestCase { - - @Test - public void testJsonToRule(){ - - // check that all the key-value pairs are specified - String json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - try { - ACLRule rule = ACLRuleResource.jsonToRule(json); - assertEquals(rule.getNw_src(),"10.0.0.1/32"); - assertEquals(rule.getNw_dst(),"10.0.0.2/32"); - int[] cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - assertEquals(rule.getNw_src_prefix(), cidr[0]); - assertEquals(rule.getNw_src_maskbits(), cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - assertEquals(rule.getNw_dst_prefix(), cidr[0]); - assertEquals(rule.getNw_dst_maskbits(), cidr[1]); - assertEquals(rule.getNw_proto(),6); - assertEquals(rule.getTp_dst(), 80); - } catch (IOException e) { - e.printStackTrace(); - } - - // check that nw_proto is not specified correctly - json = "{\"nw-prot\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - try { - ACLRule rule = ACLRuleResource.jsonToRule(json); - assertEquals(rule.getNw_src(),"10.0.0.1/32"); - assertEquals(rule.getNw_dst(),"10.0.0.2/32"); - int[] cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - assertEquals(rule.getNw_src_prefix(), cidr[0]); - assertEquals(rule.getNw_src_maskbits(), cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - assertEquals(rule.getNw_dst_prefix(), cidr[0]); - assertEquals(rule.getNw_dst_maskbits(), cidr[1]); - assertEquals(rule.getNw_proto(),0); - assertEquals(rule.getTp_dst(), 0); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - @Test - public void testStore(){ - - ACL s = new ACL(); - FloodlightModuleContext fmc = new FloodlightModuleContext(); - try { - s.init(fmc); - } catch (FloodlightModuleException e) { - e.printStackTrace(); - } - - ACLRuleResource r = new ACLRuleResource(); - Context ctx = new Context(); - r.init(ctx, null, null); - r.getContext().getAttributes().putIfAbsent(IACLService.class.getCanonicalName(), s); - - // input a valid JSON string that adds a new ACL rule - String json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Success! New rule added." + "\"}"); - - // input a valid JSON string that matches an existing rule - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! The new ACL rule matches an existing rule." + "\"}"); - - // input a valid JSON string that adds a new ACL rule - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/8\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Success! New rule added." + "\"}"); - - // input a valid JSON string that matches an existing rule - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.2/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! The new ACL rule matches an existing rule." + "\"}"); - - // input a invalid JSON string that contains neither nw_src and nw_dst - json = "{\"nw-proto\":\"TCP\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! Either nw_src or nw_dst must be specified." + "\"}"); - - // input a invalid JSON string that doesn't contain CIDR mask bits - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! " + "CIDR mask bits must be specified." + "\"}"); - - // input a invalid JSON string that contains a invalid IP address - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.256/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! Octet values in specified IPv4 address must be 0 <= value <= 255" + "\"}"); - - // input a invalid JSON string that contains a invalid IP address - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.01/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! Specified IPv4 address mustcontain 4 sets of numerical digits separated by periods" + "\"}"); - - // input a invalid JSON string that contains a invalid CIDR mask bits - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/a\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! CIDR mask bits must be specified as a number(0 ~ 32)." + "\"}"); - - // input a invalid JSON string that contains a invalid CIDR mask bits - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/33\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! CIDR mask bits must be 0 <= value <= 32." + "\"}"); - - // input a invalid JSON string that contains a invalid nw-proto value - json = "{\"nw-proto\":\"ARP\",\"src-ip\":\"10.0.0.1/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! nw-proto must be specified as (TCP || UDP || ICMP)." + "\"}"); - - // input a invalid JSON string that contains a invalid tp-dst value - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"tp-dst\":\"a\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! tp-dst must be specified as a number." + "\"}"); - - // input a invalid JSON string that contains a invalid action value - json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"tp-dst\":\"80\",\"action\":\"PERMIT\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Failed! action must be specidied as (allow || deny)." + "\"}"); - - } - - @Test - public void testRemove(){ - ACL s = new ACL(); - FloodlightModuleContext fmc = new FloodlightModuleContext(); - try { - s.init(fmc); - } catch (FloodlightModuleException e) { - e.printStackTrace(); - } - - ACLRuleResource r = new ACLRuleResource(); - Context ctx = new Context(); - r.init(ctx, null, null); - r.getContext().getAttributes().putIfAbsent(IACLService.class.getCanonicalName(), s); - - // input a valid JSON string - String json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}"; - assertEquals(r.store(json),"{\"status\" : \"" + "Success! New rule added." + "\"}"); - - // input a invalid JSON string that contains a invalid ruleid value - json = "{\"ruleid\":\"a\"}"; - assertEquals(r.remove(json),"{\"status\" : \"" + "Failed! ruleid must be specified as a number." + "\"}"); - - // input a invalid JSON string that contains a non-existing ruleid value - json = "{\"ruleid\":\"2\"}"; - assertEquals(r.remove(json),"{\"status\" : \"" + "Failed! a rule with this ID doesn't exist." + "\"}"); - - // input a valid JSON string that removes an existing ACL rule - json = "{\"ruleid\":\"1\"}"; - assertEquals(r.remove(json),"{\"status\" : \"" + "Success! Rule deleted" + "\"}"); - - } - -} diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleTest.java b/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleTest.java deleted file mode 100644 index 1ab2e6d724abede10d1a4a94ecafdfca4ef32c3e..0000000000000000000000000000000000000000 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLRuleTest.java +++ /dev/null @@ -1,162 +0,0 @@ -package net.floodlightcontroller.accesscontrollist.test; - -import static org.junit.Assert.*; -import net.floodlightcontroller.accesscontrollist.ACLRule; -import net.floodlightcontroller.accesscontrollist.util.IPAddressUtil; -import net.floodlightcontroller.test.FloodlightTestCase; - -import org.junit.Test; - -public class ACLRuleTest extends FloodlightTestCase{ - - @Test - public void testMatch(){ - - int[] cidr = new int[2]; - ACLRule rule1, rule2; - - // rule1 & rule2 are the same - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(6); - rule2.setTp_dst(80); - assertTrue(rule1.match(rule2)); - - // rule1 & rule2 are different in nw_proto - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(11); - assertFalse(rule1.match(rule2)); - - // rule1's nw_src is a subnet of rule2's nw_src - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(1); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/8"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(1); - assertTrue(rule1.match(rule2)); - - // rule1's nw_dst is a subnet of rule2's nw_dst - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(1); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/8"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(1); - assertTrue(rule1.match(rule2)); - - // rule1's nw_src is specified while rule2's is not - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - assertTrue(rule1.match(rule2)); - - // rule1's nw_dst is specified while rule2's is not - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - assertTrue(rule1.match(rule2)); - - // rule1's nw_proto is specified while rule2's is not - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - assertTrue(rule1.match(rule2)); - - // rule1's tp_dst is specified while rule2's is not - rule1 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule2 = new ACLRule(); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - cidr = IPAddressUtil.parseCIDR("10.0.0.2/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(6); - assertTrue(rule1.match(rule2)); - } -} diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLTest.java b/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLTest.java deleted file mode 100644 index fd0d80f48ec9532edc52e11366ceb8b27f1f94aa..0000000000000000000000000000000000000000 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/test/ACLTest.java +++ /dev/null @@ -1,665 +0,0 @@ -package net.floodlightcontroller.accesscontrollist.test; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.reset; -import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import net.floodlightcontroller.accesscontrollist.ACL; -import net.floodlightcontroller.accesscontrollist.ACLRule; -import net.floodlightcontroller.accesscontrollist.IACLService; -import net.floodlightcontroller.accesscontrollist.ACLRule.Action; -import net.floodlightcontroller.accesscontrollist.util.IPAddressUtil; -import net.floodlightcontroller.core.FloodlightContext; -import net.floodlightcontroller.core.IFloodlightProviderService; -import net.floodlightcontroller.core.IOFSwitch; -import net.floodlightcontroller.core.internal.IOFSwitchService; -import net.floodlightcontroller.core.module.FloodlightModuleContext; -import net.floodlightcontroller.core.test.MockThreadPoolService; -import net.floodlightcontroller.debugcounter.IDebugCounterService; -import net.floodlightcontroller.debugcounter.MockDebugCounterService; -import net.floodlightcontroller.debugevent.IDebugEventService; -import net.floodlightcontroller.debugevent.MockDebugEventService; -import net.floodlightcontroller.devicemanager.IDeviceService; -import net.floodlightcontroller.devicemanager.IEntityClassifierService; -import net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier; -import net.floodlightcontroller.devicemanager.test.MockDeviceManager; -import net.floodlightcontroller.packet.Ethernet; -import net.floodlightcontroller.packet.IPv4; -import net.floodlightcontroller.restserver.IRestApiService; -import net.floodlightcontroller.restserver.RestApiServer; -import net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher; -import net.floodlightcontroller.storage.IResultSet; -import net.floodlightcontroller.storage.IStorageSourceService; -import net.floodlightcontroller.storage.memory.MemoryStorageSource; -import net.floodlightcontroller.test.FloodlightTestCase; -import net.floodlightcontroller.threadpool.IThreadPoolService; -import net.floodlightcontroller.topology.ITopologyService; - -import org.easymock.EasyMock; -import org.junit.Before; -import org.junit.Test; -import org.projectfloodlight.openflow.protocol.OFFactories; -import org.projectfloodlight.openflow.protocol.OFVersion; -import org.projectfloodlight.openflow.types.DatapathId; -import org.projectfloodlight.openflow.types.OFPort; - -public class ACLTest extends FloodlightTestCase { - - protected FloodlightContext cntx; - protected IOFSwitch sw; - - private MockDebugEventService debugEventService; // dependency for device manager - private DefaultEntityClassifier entityClassifier; // dependency for device manager - private MockThreadPoolService tps; // dependency for device manager - private ITopologyService topology; // dependency for device manager - private MockDeviceManager deviceManager; - - private MockDebugCounterService debugCounterService; - private MemoryStorageSource storageService; - - private RestApiServer restApi; - private ACL acl; - - public static String TestSwitch1DPID = "00:00:00:00:00:00:00:01"; - - @Override - @Before - public void setUp() throws Exception { - - super.setUp(); - cntx = new FloodlightContext(); - mockFloodlightProvider = getMockFloodlightProvider(); - mockSwitchManager = getMockSwitchService(); - - debugEventService = new MockDebugEventService(); - entityClassifier = new DefaultEntityClassifier(); - tps = new MockThreadPoolService(); - deviceManager = new MockDeviceManager(); - topology = createMock(ITopologyService.class); - debugCounterService = new MockDebugCounterService(); - storageService = new MemoryStorageSource(); - restApi = new RestApiServer(); - acl = new ACL(); - - // Mock switches - DatapathId dpid = DatapathId.of(TestSwitch1DPID); - sw = EasyMock.createNiceMock(IOFSwitch.class); - expect(sw.getId()).andReturn(dpid).anyTimes(); - expect(sw.getOFFactory()).andReturn( - OFFactories.getFactory(OFVersion.OF_13)).anyTimes(); - replay(sw); - // Load the switch map - Map<DatapathId, IOFSwitch> switches = new HashMap<DatapathId, IOFSwitch>(); - switches.put(dpid, sw); - mockSwitchManager.setSwitches(switches); - - FloodlightModuleContext fmc = new FloodlightModuleContext(); - fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider); - fmc.addService(IOFSwitchService.class, mockSwitchManager); - fmc.addService(IDebugCounterService.class, debugCounterService); - fmc.addService(IStorageSourceService.class, storageService); - fmc.addService(IDebugEventService.class, debugEventService); - fmc.addService(IEntityClassifierService.class, entityClassifier); - fmc.addService(IThreadPoolService.class, tps); - fmc.addService(IDeviceService.class, deviceManager); - fmc.addService(ITopologyService.class, topology); - fmc.addService(IRestApiService.class, restApi); - fmc.addService(IACLService.class, acl); - - topology.addListener(deviceManager); - expectLastCall().times(1); - replay(topology); - - debugCounterService.init(fmc); - entityClassifier.init(fmc); - tps.init(fmc); - deviceManager.init(fmc); - storageService.init(fmc); - restApi.init(fmc); - acl.init(fmc); - - debugCounterService.startUp(fmc); - deviceManager.startUp(fmc); - entityClassifier.startUp(fmc); - tps.startUp(fmc); - storageService.startUp(fmc); - acl.startUp(fmc); - verify(topology); - - storageService.createTable(StaticFlowEntryPusher.TABLE_NAME, null); - storageService.setTablePrimaryKeyName(StaticFlowEntryPusher.TABLE_NAME, - StaticFlowEntryPusher.COLUMN_NAME); - - } - - @Test - public void testAddRule() { - - reset(topology); -// expect(topology.isIncomingBroadcastAllowed(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); -// expect(topology.getL2DomainId(DatapathId.of(1L))).andReturn(DatapathId.of(1L)).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(1))).andReturn(true).anyTimes(); - replay(topology); - - int[] cidr = new int[2]; - ACLRule rule1, rule2, rule3, rule4; - IResultSet resultSet; - Iterator<IResultSet> it; - Map<String, Object> row; - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1 ip:10.0.0.1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, IPv4.toIPv4Address("10.0.0.1"), 1L, 1); - - // a new AP[dpid:00:00:00:00:00:00:00:02 port:1 ip:10.0.0.3] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:03")), - null, IPv4.toIPv4Address("10.0.0.3"), 2L, 1); - - // rule1 indicates host(10.0.0.0/28) can not access TCP port 80 in host(10.0.0.254/32) - rule1 = new ACLRule(); - rule1.setNw_src("10.0.0.0/28"); - cidr = IPAddressUtil.parseCIDR("10.0.0.0/28"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - rule1.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule1.setAction(Action.DENY); - - assertEquals(acl.addRule(rule1), true); - assertEquals(acl.getRules().size(), 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - // rule2 matches rule1 - rule2 = new ACLRule(); - rule2.setNw_src("10.0.0.1/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule2.setNw_src_prefix(cidr[0]); - rule2.setNw_src_maskbits(cidr[1]); - rule2.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(6); - rule2.setTp_dst(80); - rule2.setAction(Action.DENY); - - // there will be no extra flow entry - assertEquals(acl.addRule(rule1), false); - assertEquals(acl.getRules().size(), 1); - - // rule3 indicates that no ICMP packets can reach host[10.0.0.3/32] - rule3 = new ACLRule(); - rule3.setNw_dst("10.0.0.3/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.3/32"); - rule3.setNw_dst_prefix(cidr[0]); - rule3.setNw_dst_maskbits(cidr[1]); - rule3.setNw_proto(1); - rule3.setAction(Action.DENY); - - assertEquals(acl.addRule(rule3), true); - assertEquals(acl.getRules().size(), 2); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_2_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"29999"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src"), null); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.3/32"); - assertEquals(row.get("ip_proto").toString(),"1"); - assertEquals(row.get("tp_dst"), null); - assertEquals(row.get("actions"), null); - } - - // rule4 indicates that host(10.0.0.1/32) can access host(10.0.0.3/32) - rule4 = new ACLRule(); - rule4.setNw_src("10.0.0.1/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - rule4.setNw_src_prefix(cidr[0]); - rule4.setNw_src_maskbits(cidr[1]); - rule4.setNw_dst("10.0.0.3/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.3/32"); - rule4.setNw_dst_prefix(cidr[0]); - rule4.setNw_dst_maskbits(cidr[1]); - rule4.setAction(Action.ALLOW); - - assertEquals(acl.addRule(rule4), true); - assertEquals(acl.getRules().size(), 3); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_3_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"29999"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(), "10.0.0.1/32"); - assertEquals(row.get("ipv4_dst").toString(), "10.0.0.3/32"); - assertEquals(row.get("ip_proto"), null); - assertEquals(row.get("tp_dst"), null); - assertEquals(row.get("actions"), "output=controller"); - } - - } - - @Test - public void testDeviceAdded() { - - reset(topology); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(2))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(2))).andReturn(true).anyTimes(); - replay(topology); - - int[] cidr = new int[2]; - ACLRule rule1, rule2; - IResultSet resultSet; - Iterator<IResultSet> it; - Map<String, Object> row; - - // rule1 indicates host(10.0.0.0/28) can not access TCP port 80 in host(10.0.0.254/32) - rule1 = new ACLRule(); - rule1.setNw_src("10.0.0.0/28"); - cidr = IPAddressUtil.parseCIDR("10.0.0.0/28"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - rule1.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule1.setAction(Action.DENY); - - assertEquals(acl.addRule(rule1), true); - assertEquals(acl.getRules().size(), 1); - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1 ip:10.0.0.1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, IPv4.toIPv4Address("10.0.0.1"), 1L, 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:2 ip:10.0.0.2] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:02")), - null, IPv4.toIPv4Address("10.0.0.2"), 1L, 2); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - int count = 0; - while(it.hasNext()){ - row = it.next().getRow(); - count++; - } - // there is no extra flow entry added - assertEquals(count, 1); - - // rule2 indicates that no ICMP packets can reach host[10.0.0.3/32] - rule2 = new ACLRule(); - rule2.setNw_dst("10.0.0.3/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.3/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(1); - rule2.setAction(Action.DENY); - - assertEquals(acl.addRule(rule2), true); - assertEquals(acl.getRules().size(), 2); - - // a new AP[dpid:00:00:00:00:00:00:00:02 port:1 ip:10.0.0.3] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:03")), - null, IPv4.toIPv4Address("10.0.0.3"), 2L, 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_2_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"29999"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src"), null); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.3/32"); - assertEquals(row.get("ip_proto").toString(),"1"); - assertEquals(row.get("tp_dst"), null); - assertEquals(row.get("actions"), null); - } - } - - @Test - public void testDeviceIPV4AddrChanged() { - - reset(topology); - expect(topology.getL2DomainId(DatapathId.of(1L))).andReturn(DatapathId.of(1L)).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(1))).andReturn(true).anyTimes(); - replay(topology); - - int[] cidr = new int[2]; - ACLRule rule1; - IResultSet resultSet; - Iterator<IResultSet> it; - Map<String, Object> row; - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, null, 1L, 1); - - // rule1 indicates host(10.0.0.0/28) can not access TCP port 80 in host(10.0.0.254/32) - rule1 = new ACLRule(); - rule1.setNw_src("10.0.0.0/28"); - cidr = IPAddressUtil.parseCIDR("10.0.0.0/28"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - rule1.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule1.setAction(Action.DENY); - - assertEquals(acl.addRule(rule1), true); - assertEquals(acl.getRules().size(), 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1 ip:10.0.0.1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, IPv4.toIPv4Address("10.0.0.1"), 1L, 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - } - - @Test - public void testDeleteRule(){ - reset(topology); -// expect(topology.isIncomingBroadcastAllowed(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); -// expect(topology.getL2DomainId(DatapathId.of(1L))).andReturn(DatapathId.of(1L)).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(1))).andReturn(true).anyTimes(); - replay(topology); - - int[] cidr = new int[2]; - ACLRule rule1; - IResultSet resultSet; - Iterator<IResultSet> it; - Map<String, Object> row; - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1 ip:10.0.0.1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, IPv4.toIPv4Address("10.0.0.1"), 1L, 1); - - // a new AP[dpid:00:00:00:00:00:00:00:02 port:1 ip:10.0.0.3] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:03")), - null, IPv4.toIPv4Address("10.0.0.3"), 2L, 1); - - // rule1 indicates host(10.0.0.0/28) can not access TCP port 80 in host(10.0.0.254/32) - rule1 = new ACLRule(); - rule1.setNw_src("10.0.0.0/28"); - cidr = IPAddressUtil.parseCIDR("10.0.0.0/28"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - rule1.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule1.setAction(Action.DENY); - - assertEquals(acl.addRule(rule1), true); - assertEquals(acl.getRules().size(), 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - // remove rule1 and all relevant flow entries will be removed - acl.removeRule(1); - assertEquals(acl.getRules().size(),0); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - } - - @Test - public void testDeleteAllRules(){ - reset(topology); -// expect(topology.isIncomingBroadcastAllowed(DatapathId.of(anyLong()), OFPort.of(anyShort()))).andReturn(true).anyTimes(); -// expect(topology.getL2DomainId(DatapathId.of(1L))).andReturn(DatapathId.of(1L)).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes(); - expect(topology.isAttachmentPointPort(DatapathId.of(2L), OFPort.of(1))).andReturn(true).anyTimes(); - replay(topology); - - int[] cidr = new int[2]; - ACLRule rule1, rule2; - IResultSet resultSet; - Iterator<IResultSet> it; - Map<String, Object> row; - - // a new AP[dpid:00:00:00:00:00:00:00:01 port:1 ip:10.0.0.1] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:01")), - null, IPv4.toIPv4Address("10.0.0.1"), 1L, 1); - - // a new AP[dpid:00:00:00:00:00:00:00:02 port:1 ip:10.0.0.3] appears - deviceManager.learnEntity( - Ethernet.toLong(Ethernet.toMACAddress("00:00:00:00:00:03")), - null, IPv4.toIPv4Address("10.0.0.3"), 2L, 1); - - // rule1 indicates host(10.0.0.0/28) can not access TCP port 80 in host(10.0.0.254/32) - rule1 = new ACLRule(); - rule1.setNw_src("10.0.0.0/28"); - cidr = IPAddressUtil.parseCIDR("10.0.0.0/28"); - rule1.setNw_src_prefix(cidr[0]); - rule1.setNw_src_maskbits(cidr[1]); - rule1.setNw_dst("10.0.0.254/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.254/32"); - rule1.setNw_dst_prefix(cidr[0]); - rule1.setNw_dst_maskbits(cidr[1]); - rule1.setNw_proto(6); - rule1.setTp_dst(80); - rule1.setAction(Action.DENY); - - assertEquals(acl.addRule(rule1), true); - assertEquals(acl.getRules().size(), 1); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:01"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"30000"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src").toString(),"10.0.0.0/28"); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.254/32"); - assertEquals(row.get("ip_proto").toString(),"6"); - assertEquals(row.get("tp_dst").toString(),"80"); - assertEquals(row.get("actions"), null); - } - - // rule3 indicates that no ICMP packets can reach host[10.0.0.3/32] - rule2 = new ACLRule(); - rule2.setNw_dst("10.0.0.3/32"); - cidr = IPAddressUtil.parseCIDR("10.0.0.3/32"); - rule2.setNw_dst_prefix(cidr[0]); - rule2.setNw_dst_maskbits(cidr[1]); - rule2.setNw_proto(1); - rule2.setAction(Action.DENY); - - assertEquals(acl.addRule(rule2), true); - assertEquals(acl.getRules().size(), 2); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_2_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - while(it.hasNext()){ - row = it.next().getRow(); - assertEquals(row.get("switch").toString(),"00:00:00:00:00:00:00:02"); - assertEquals(row.get("priority").toString(),"29999"); - assertEquals(row.get("eth_type").toString(),"2048"); - assertEquals(row.get("ipv4_src"), null); - assertEquals(row.get("ipv4_dst").toString(),"10.0.0.3/32"); - assertEquals(row.get("ip_proto").toString(),"1"); - assertEquals(row.get("tp_dst"), null); - assertEquals(row.get("actions"), null); - } - - // remove all rules and all relevant flow entries will be removed - acl.removeAllRules(); - assertEquals(acl.getRules().size(),0); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:01"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_1_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - resultSet = storageService.getRow( - StaticFlowEntryPusher.TABLE_NAME, "ACLRule_2_00:00:00:00:00:00:00:02"); - it = resultSet.iterator(); - assertEquals(it.hasNext(), false); - - } -} diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/test/APManagerTest.java b/src/main/java/net/floodlightcontroller/accesscontrollist/test/APManagerTest.java deleted file mode 100644 index 314ab55cd14b354db12d9d93584c02f769651963..0000000000000000000000000000000000000000 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/test/APManagerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.floodlightcontroller.accesscontrollist.test; - -import static org.junit.Assert.*; - -import java.util.HashSet; -import java.util.Set; - -import net.floodlightcontroller.accesscontrollist.ap.AP; -import net.floodlightcontroller.accesscontrollist.ap.APManager; -import net.floodlightcontroller.accesscontrollist.util.IPAddressUtil; -import net.floodlightcontroller.test.FloodlightTestCase; - -import org.junit.Test; - -public class APManagerTest extends FloodlightTestCase { - - @Test - public void testGetDpidSet(){ - - AP ap1 = new AP("10.0.0.1","00:00:00:00:00:00:00:01"); - AP ap2 = new AP("10.0.0.2","00:00:00:00:00:00:00:02"); - AP ap3 = new AP("10.0.0.3","00:00:00:00:00:00:00:03"); - - APManager apManager = new APManager(); - apManager.addAP(ap1); - apManager.addAP(ap2); - apManager.addAP(ap3); - - int cidr[]; - - // test CIDR IP with suffix that equals "/32" - cidr = IPAddressUtil.parseCIDR("10.0.0.1/32"); - Set<String> resultSet = apManager.getDpidSet(cidr[0],cidr[1]); - Set<String> expectedSet = new HashSet<String>(); - expectedSet.add("00:00:00:00:00:00:00:01"); - assertEquals(resultSet, expectedSet); - - // test CIDR IP with suffix that does not equal "/32" - cidr = IPAddressUtil.parseCIDR("10.0.0.1/30"); - resultSet = apManager.getDpidSet(cidr[0],cidr[1]); - expectedSet = new HashSet<String>(); - expectedSet.add("00:00:00:00:00:00:00:01"); - expectedSet.add("00:00:00:00:00:00:00:02"); - expectedSet.add("00:00:00:00:00:00:00:03"); - assertEquals(resultSet, expectedSet); - - // test CIDR IP does not exist in the network - cidr = IPAddressUtil.parseCIDR("10.0.0.4/32"); - resultSet = apManager.getDpidSet(cidr[0],cidr[1]); - expectedSet = new HashSet<String>(); - assertEquals(resultSet, expectedSet); - - } -} diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/test/IPAddressUtilTest.java b/src/main/java/net/floodlightcontroller/accesscontrollist/test/IPAddressUtilTest.java deleted file mode 100644 index a23a4a7a414eed1a9199d94bc356339f0a326071..0000000000000000000000000000000000000000 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/test/IPAddressUtilTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.floodlightcontroller.accesscontrollist.test; - -import static org.junit.Assert.*; -import net.floodlightcontroller.accesscontrollist.util.IPAddressUtil; -import net.floodlightcontroller.packet.IPv4; -import net.floodlightcontroller.test.FloodlightTestCase; - -import org.junit.Test; - -public class IPAddressUtilTest extends FloodlightTestCase { - - @Test - public void testParseCIDR(){ - - String cidr = "10.0.0.1/32"; - int[] resultArray = IPAddressUtil.parseCIDR(cidr); - assertEquals(resultArray[0],IPv4.toIPv4Address("10.0.0.1")); - assertEquals(resultArray[1],32); - } - - @Test - public void testContainIP(){ - - int[] cidr = IPAddressUtil.parseCIDR("10.0.0.0/8"); - int ip = IPv4.toIPv4Address("10.0.0.1"); - assertTrue(IPAddressUtil.containIP(cidr[0], cidr[1], ip)); - } - - @Test - public void testIsSubnet(){ - - assertFalse(IPAddressUtil.isSubnet("10.0.0.1/32", "10.0.0.2/32")); - assertTrue(IPAddressUtil.isSubnet("10.0.0.1/8", "10.0.0.2/8")); - assertTrue(IPAddressUtil.isSubnet("10.0.0.1/32", "10.0.0.2/8")); - assertFalse(IPAddressUtil.isSubnet("10.0.0.1/8", "10.0.0.2/32")); - assertTrue(IPAddressUtil.isSubnet("10.0.0.1/8", null)); - assertFalse(IPAddressUtil.isSubnet(null, "10.0.0.2/32")); - } - -} diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/util/IPAddressUtil.java b/src/main/java/net/floodlightcontroller/accesscontrollist/util/IPAddressUtil.java index d4bb589739e50006ddfa3209510c4ebaa9db0856..8f51a685d4f7e3836c1e878d93c94557d2aaaab1 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/util/IPAddressUtil.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/util/IPAddressUtil.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.util; import net.floodlightcontroller.packet.IPv4; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLRuleResource.java b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLRuleResource.java index c4d5be2415d92769ad30997f0eced0a5b99221c3..ed2ada4194fd2a921f6d1be347301a9ad158e2aa 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLRuleResource.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLRuleResource.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.web; import java.io.IOException; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLWebRoutable.java b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLWebRoutable.java index 5824083f58b0034a0b1cf7f29beed3248b550873..3df4de637cda1c0f54a890512c2c8bafff9be0d4 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLWebRoutable.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ACLWebRoutable.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.web; import net.floodlightcontroller.restserver.RestletRoutable; diff --git a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ClearACRulesResource.java b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ClearACRulesResource.java index 7157679c358baf33adceec3259e90e553313acd5..87eb9887b488dbc066a908620a61ff2efb9cdb45 100644 --- a/src/main/java/net/floodlightcontroller/accesscontrollist/web/ClearACRulesResource.java +++ b/src/main/java/net/floodlightcontroller/accesscontrollist/web/ClearACRulesResource.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist.web; import net.floodlightcontroller.accesscontrollist.IACLService; diff --git a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleResourceTest.java b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleResourceTest.java index 8f441e0811d61efaec1749b3940cb3f793f88540..f16f7561d2a3c1007b6db8d37523db244c655555 100644 --- a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleResourceTest.java +++ b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleResourceTest.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleTest.java b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleTest.java index 32b59ba787b679d88c373856748137007e993bfa..2a05a0f60f229b65c71e787c91381c85b6e1a8a4 100644 --- a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleTest.java +++ b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLRuleTest.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static org.junit.Assert.*; diff --git a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLTest.java b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLTest.java index 8b74f3fdf72986012981452d047637a39a1f4517..9b473d2f203542ddd89b5f2b75dfc5d231b71cb0 100644 --- a/src/test/java/net/floodlightcontroller/accesscontrollist/ACLTest.java +++ b/src/test/java/net/floodlightcontroller/accesscontrollist/ACLTest.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static org.easymock.EasyMock.createMock; diff --git a/src/test/java/net/floodlightcontroller/accesscontrollist/APManagerTest.java b/src/test/java/net/floodlightcontroller/accesscontrollist/APManagerTest.java index c0742a21f13c8eacacb82d8016fb72296a8fa1f9..832dd40a5dcb3b712035eca6c87624e35f96b6c4 100644 --- a/src/test/java/net/floodlightcontroller/accesscontrollist/APManagerTest.java +++ b/src/test/java/net/floodlightcontroller/accesscontrollist/APManagerTest.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static org.junit.Assert.*; diff --git a/src/test/java/net/floodlightcontroller/accesscontrollist/IPAddressUtilTest.java b/src/test/java/net/floodlightcontroller/accesscontrollist/IPAddressUtilTest.java index b3b80fe954df9767d4813dbdf81c4798b3239d85..f70781e44c1c9e985a8f5e2c06304823b12b5b53 100644 --- a/src/test/java/net/floodlightcontroller/accesscontrollist/IPAddressUtilTest.java +++ b/src/test/java/net/floodlightcontroller/accesscontrollist/IPAddressUtilTest.java @@ -1,3 +1,20 @@ +/** + * Copyright 2015, Big Switch Networks, Inc. + * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + package net.floodlightcontroller.accesscontrollist; import static org.junit.Assert.*;