test_class.declarator: cntx
test_class.modifier: protected
test_class.original_string: protected FloodlightContext cntx;
test_class.type: FloodlightContext
test_class.var_name: cntx
test_class.declarator: sw
test_class.modifier: protected
test_class.original_string: protected IOFSwitch sw;
test_class.type: IOFSwitch
test_class.var_name: sw
test_class.declarator: debugEventService
test_class.modifier: private
test_class.original_string: private MockDebugEventService debugEventService;
test_class.type: MockDebugEventService
test_class.var_name: debugEventService
test_class.declarator: entityClassifier
test_class.modifier: private
test_class.original_string: private DefaultEntityClassifier entityClassifier;
test_class.type: DefaultEntityClassifier
test_class.var_name: entityClassifier
test_class.declarator: tps
test_class.modifier: private
test_class.original_string: private MockThreadPoolService tps;
test_class.type: MockThreadPoolService
test_class.var_name: tps
test_class.declarator: topology
test_class.modifier: private
test_class.original_string: private ITopologyService topology;
test_class.type: ITopologyService
test_class.var_name: topology
test_class.declarator: deviceManager
test_class.modifier: private
test_class.original_string: private MockDeviceManager deviceManager;
test_class.type: MockDeviceManager
test_class.var_name: deviceManager
test_class.declarator: debugCounterService
test_class.modifier: private
test_class.original_string: private MockDebugCounterService debugCounterService;
test_class.type: MockDebugCounterService
test_class.var_name: debugCounterService
test_class.declarator: storageService
test_class.modifier: private
test_class.original_string: private MemoryStorageSource storageService;
test_class.type: MemoryStorageSource
test_class.var_name: storageService
test_class.declarator: restApi
test_class.modifier: private
test_class.original_string: private RestApiServer restApi;
test_class.type: RestApiServer
test_class.var_name: restApi
test_class.declarator: acl
test_class.modifier: private
test_class.original_string: private ACL acl;
test_class.type: ACL
test_class.var_name: acl
test_class.declarator: TestSwitch1DPID = "00:00:00:00:00:00:00:01"
test_class.modifier: public static
test_class.original_string: public static String TestSwitch1DPID = "00:00:00:00:00:00:00:01";
test_class.type: String
test_class.var_name: TestSwitch1DPID
test_class.file: src/agents/apps/floodlight/floodlight-1.1/src/test/java/net/floodlightcontroller/accesscontrollist/ACLTest.java
test_class.identifier: ACLTest
test_class.superclass: extends FloodlightTestCase
test_case.body: @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_case.class_method_signature: ACLTest.testDeviceIPV4AddrChanged()
test_case.full_signature: @Test public void testDeviceIPV4AddrChanged()
test_case.identifier: testDeviceIPV4AddrChanged
test_case.invocations: reset anyTimes andReturn expect getL2DomainId of of anyTimes andReturn expect isAttachmentPointPort of of anyTimes andReturn expect isAttachmentPointPort of of replay learnEntity toLong toMACAddress setNw_src parseCIDR setNw_src_prefix setNw_src_maskbits setNw_dst parseCIDR setNw_dst_prefix setNw_dst_maskbits setNw_proto setTp_dst setAction assertEquals addRule assertEquals size getRules getRow iterator assertEquals hasNext learnEntity toLong toMACAddress toIPv4Address getRow iterator hasNext getRow next assertEquals toString get assertEquals toString get assertEquals toString get assertEquals toString get assertEquals toString get assertEquals toString get assertEquals toString get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDeviceIPV4AddrChanged()
focal_class.declarator: restApi
focal_class.modifier: protected
focal_class.original_string: protected IRestApiService restApi;
focal_class.type: IRestApiService
focal_class.var_name: restApi
focal_class.declarator: deviceManager
focal_class.modifier: protected
focal_class.original_string: protected IDeviceService deviceManager;
focal_class.type: IDeviceService
focal_class.var_name: deviceManager
focal_class.declarator: storageSource
focal_class.modifier: protected
focal_class.original_string: protected IStorageSourceService storageSource;
focal_class.type: IStorageSourceService
focal_class.var_name: storageSource
focal_class.declarator: logger
focal_class.modifier: protected static
focal_class.original_string: protected static Logger logger;
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: apManager
focal_class.modifier: private
focal_class.original_string: private APManager apManager;
focal_class.type: APManager
focal_class.var_name: apManager
focal_class.declarator: lastRuleId = 1
focal_class.modifier: private
focal_class.original_string: private int lastRuleId = 1;
focal_class.type: int
focal_class.var_name: lastRuleId
focal_class.declarator: ruleSet
focal_class.modifier: private
focal_class.original_string: private List<ACLRule> ruleSet;
focal_class.type: List<ACLRule>
focal_class.var_name: ruleSet
focal_class.declarator: dpid2FlowPriority
focal_class.modifier: private
focal_class.original_string: private Map<String, Integer> dpid2FlowPriority;
focal_class.type: Map<String, Integer>
focal_class.var_name: dpid2FlowPriority
focal_class.declarator: ruleId2Dpid
focal_class.modifier: private
focal_class.original_string: private Map<Integer, Set<String>> ruleId2Dpid;
focal_class.type: Map<Integer, Set<String>>
focal_class.var_name: ruleId2Dpid
focal_class.declarator: ruleId2FlowName
focal_class.modifier: private
focal_class.original_string: private Map<Integer, Set<String>> ruleId2FlowName;
focal_class.type: Map<Integer, Set<String>>
focal_class.var_name: ruleId2FlowName
focal_class.file: src/agents/apps/floodlight/floodlight-1.1/src/main/java/net/floodlightcontroller/accesscontrollist/ACL.java
focal_class.identifier: ACL
focal_class.interfaces: implements IACLService, IFloodlightModule, IDeviceListener
focal_class.class_method_signature: ACL.getRules()
focal_class.full_signature: @Override public List<ACLRule> getRules()
focal_class.identifier: getRules
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<ACLRule>
focal_class.signature: List<ACLRule> getRules()
focal_class.class_method_signature: ACL.checkRuleMatch(ACLRule newRule)
focal_class.full_signature: private boolean checkRuleMatch(ACLRule newRule)
focal_class.identifier: checkRuleMatch
focal_class.modifiers: private
focal_class.parameters: (ACLRule newRule)
focal_class.return: boolean
focal_class.signature: boolean checkRuleMatch(ACLRule newRule)
focal_class.class_method_signature: ACL.addRule(ACLRule rule)
focal_class.full_signature: @Override public boolean addRule(ACLRule rule)
focal_class.identifier: addRule
focal_class.modifiers: @Override public
focal_class.parameters: (ACLRule rule)
focal_class.return: boolean
focal_class.signature: boolean addRule(ACLRule rule)
focal_class.class_method_signature: ACL.removeRule(int ruleid)
focal_class.full_signature: @Override public void removeRule(int ruleid)
focal_class.identifier: removeRule
focal_class.modifiers: @Override public
focal_class.parameters: (int ruleid)
focal_class.return: void
focal_class.signature: void removeRule(int ruleid)
focal_class.class_method_signature: ACL.removeAllRules()
focal_class.full_signature: @Override public void removeAllRules()
focal_class.identifier: removeAllRules
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void removeAllRules()
focal_class.class_method_signature: ACL.enforceAddedRule(ACLRule rule)
focal_class.full_signature: private void enforceAddedRule(ACLRule rule)
focal_class.identifier: enforceAddedRule
focal_class.modifiers: private
focal_class.parameters: (ACLRule rule)
focal_class.return: void
focal_class.signature: void enforceAddedRule(ACLRule rule)
focal_class.class_method_signature: ACL.enforceRemovedRule(int ruleId)
focal_class.full_signature: private void enforceRemovedRule(int ruleId)
focal_class.identifier: enforceRemovedRule
focal_class.modifiers: private
focal_class.parameters: (int ruleId)
focal_class.return: void
focal_class.signature: void enforceRemovedRule(int ruleId)
focal_class.class_method_signature: ACL.generateFlow(ACLRule rule, String dpid, String flowName)
focal_class.full_signature: private void generateFlow(ACLRule rule, String dpid, String flowName)
focal_class.identifier: generateFlow
focal_class.modifiers: private
focal_class.parameters: (ACLRule rule, String dpid, String flowName)
focal_class.return: void
focal_class.signature: void generateFlow(ACLRule rule, String dpid, String flowName)
focal_class.class_method_signature: ACL.removeFlow(String name)
focal_class.full_signature: private void removeFlow(String name)
focal_class.identifier: removeFlow
focal_class.modifiers: private
focal_class.parameters: (String name)
focal_class.return: void
focal_class.signature: void removeFlow(String name)
focal_class.class_method_signature: ACL.getModuleServices()
focal_class.full_signature: @Override public Collection<Class<? extends IFloodlightService>> getModuleServices()
focal_class.identifier: getModuleServices
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<Class<? extends IFloodlightService>>
focal_class.signature: Collection<Class<? extends IFloodlightService>> getModuleServices()
focal_class.class_method_signature: ACL.getServiceImpls()
focal_class.full_signature: @Override public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls()
focal_class.identifier: getServiceImpls
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Map<Class<? extends IFloodlightService>, IFloodlightService>
focal_class.signature: Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls()
focal_class.class_method_signature: ACL.getModuleDependencies()
focal_class.full_signature: @Override public Collection<Class<? extends IFloodlightService>> getModuleDependencies()
focal_class.identifier: getModuleDependencies
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<Class<? extends IFloodlightService>>
focal_class.signature: Collection<Class<? extends IFloodlightService>> getModuleDependencies()
focal_class.class_method_signature: ACL.init(FloodlightModuleContext context)
focal_class.full_signature: @Override public void init(FloodlightModuleContext context)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (FloodlightModuleContext context)
focal_class.return: void
focal_class.signature: void init(FloodlightModuleContext context)
focal_class.class_method_signature: ACL.startUp(FloodlightModuleContext context)
focal_class.full_signature: @Override public void startUp(FloodlightModuleContext context)
focal_class.identifier: startUp
focal_class.modifiers: @Override public
focal_class.parameters: (FloodlightModuleContext context)
focal_class.return: void
focal_class.signature: void startUp(FloodlightModuleContext context)
focal_class.class_method_signature: ACL.deviceAdded(IDevice device)
focal_class.full_signature: @Override public void deviceAdded(IDevice device)
focal_class.identifier: deviceAdded
focal_class.modifiers: @Override public
focal_class.parameters: (IDevice device)
focal_class.return: void
focal_class.signature: void deviceAdded(IDevice device)
focal_class.class_method_signature: ACL.processAPAdded(AP ap)
focal_class.full_signature: private void processAPAdded(AP ap)
focal_class.identifier: processAPAdded
focal_class.modifiers: private
focal_class.parameters: (AP ap)
focal_class.return: void
focal_class.signature: void processAPAdded(AP ap)
focal_class.class_method_signature: ACL.deviceRemoved(IDevice device)
focal_class.full_signature: @Override public void deviceRemoved(IDevice device)
focal_class.identifier: deviceRemoved
focal_class.modifiers: @Override public
focal_class.parameters: (IDevice device)
focal_class.return: void
focal_class.signature: void deviceRemoved(IDevice device)
focal_class.class_method_signature: ACL.deviceMoved(IDevice device)
focal_class.full_signature: @Override public void deviceMoved(IDevice device)
focal_class.identifier: deviceMoved
focal_class.modifiers: @Override public
focal_class.parameters: (IDevice device)
focal_class.return: void
focal_class.signature: void deviceMoved(IDevice device)
focal_class.class_method_signature: ACL.deviceIPV4AddrChanged(IDevice device)
focal_class.full_signature: @Override public void deviceIPV4AddrChanged(IDevice device)
focal_class.identifier: deviceIPV4AddrChanged
focal_class.modifiers: @Override public
focal_class.parameters: (IDevice device)
focal_class.return: void
focal_class.signature: void deviceIPV4AddrChanged(IDevice device)
focal_class.class_method_signature: ACL.deviceVlanChanged(IDevice device)
focal_class.full_signature: @Override public void deviceVlanChanged(IDevice device)
focal_class.identifier: deviceVlanChanged
focal_class.modifiers: @Override public
focal_class.parameters: (IDevice device)
focal_class.return: void
focal_class.signature: void deviceVlanChanged(IDevice device)
focal_class.class_method_signature: ACL.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: ACL.isCallbackOrderingPrereq(String type, String name)
focal_class.full_signature: @Override public boolean isCallbackOrderingPrereq(String type, String name)
focal_class.identifier: isCallbackOrderingPrereq
focal_class.modifiers: @Override public
focal_class.parameters: (String type, String name)
focal_class.return: boolean
focal_class.signature: boolean isCallbackOrderingPrereq(String type, String name)
focal_class.class_method_signature: ACL.isCallbackOrderingPostreq(String type, String name)
focal_class.full_signature: @Override public boolean isCallbackOrderingPostreq(String type, String name)
focal_class.identifier: isCallbackOrderingPostreq
focal_class.modifiers: @Override public
focal_class.parameters: (String type, String name)
focal_class.return: boolean
focal_class.signature: boolean isCallbackOrderingPostreq(String type, String name)
focal_method.body: @Override
  	public void deviceIPV4AddrChanged(IDevice device) {
  		
  		SwitchPort[] switchPort = device.getAttachmentPoints();
  		IPv4Address[] ips = device.getIPv4Addresses();
  		
  		String dpid = HexString.toHexString(switchPort[0].getSwitchDPID().getLong());
  		String ip = null;
  		
  		// some device may first appear with no IP address(default set to 0.0.0.0), ignore it
  		for(IPv4Address i : ips){
  			if(i.getInt() != 0){
  				ip = IPv4.fromIPv4Address(i.getInt());
  				break;
  			}
  		}
  		
  		logger.info("New AP added. [dpid:" + dpid + " ip:" + ip + "]");
  		AP ap = new AP(ip, dpid);
  		apManager.addAP(ap);
  		processAPAdded(ap);
  	}
focal_method.class_method_signature: ACL.deviceIPV4AddrChanged(IDevice device)
focal_method.full_signature: @Override public void deviceIPV4AddrChanged(IDevice device)
focal_method.identifier: deviceIPV4AddrChanged
focal_method.invocations: getAttachmentPoints getIPv4Addresses toHexString getLong getSwitchDPID getInt fromIPv4Address getInt info addAP processAPAdded
focal_method.modifiers: @Override public
focal_method.parameters: (IDevice device)
focal_method.return: void
focal_method.signature: void deviceIPV4AddrChanged(IDevice device)