def fake_cwf_setup(ue_mac_controller, setup_ue_mac_request=None): if setup_ue_mac_request is None: setup_ue_mac_request = SetupUEMacRequest( requests=[], epoch=global_epoch, ) ue_mac_controller.init_finished = False TestCase().assertEqual(setup_controller( ue_mac_controller, setup_ue_mac_request), SetupFlowsResult.SUCCESS)
def test_ue_mac_restart(self, _): """ Verify that default flows are properly installed with empty setup Verify that ue mac flows are properly restored """ imsi1 = 'IMSI111111111111111' imsi2 = 'IMSI222222222222222' mac1 = '5e:cc:cc:b1:aa:aa' mac2 = 'b2:6a:f3:b3:2f:4c' ap_mac_addr1 = '11:22:33:44:55:66' ap_mac_addr2 = '12:12:13:24:25:26' fake_cwf_setup(ue_mac_controller=self.ue_mac_controller) snapshot_verifier = SnapshotVerifier(self, self.BRIDGE, self.service_manager, 'default_flows', include_stats=False) with snapshot_verifier: pass setup_ue_mac_request = SetupUEMacRequest( requests=[ UEMacFlowRequest( sid=SIDUtils.to_pb(imsi1), mac_addr=mac1, msisdn='123456', ap_mac_addr=ap_mac_addr1, ap_name='magma', pdp_start_time=1, ), UEMacFlowRequest( sid=SIDUtils.to_pb(imsi2), mac_addr=mac2, msisdn='654321', ap_mac_addr=ap_mac_addr2, ap_name='amgam', pdp_start_time=9, ), ], epoch=global_epoch, ) fake_cwf_setup(ue_mac_controller=self.ue_mac_controller, setup_ue_mac_request=setup_ue_mac_request) snapshot_verifier = SnapshotVerifier(self, self.BRIDGE, self.service_manager, 'recovery_flows', include_stats=False) with snapshot_verifier: pass
def test_ue_mac_restart(self, directoryd_mock): """ Verify that default flows are properly installed with empty setup Verify that ue mac flows are properly restored, with arp recovery from directoryd """ imsi1 = 'IMSI111111111111111' imsi2 = 'IMSI222222222222222' ip1 = '152.81.12.41' mac1 = '5e:cc:cc:b1:aa:aa' mac2 = 'b2:6a:f3:b3:2f:4c' ap_mac_addr1 = '11:22:33:44:55:66' ap_mac_addr2 = '12:12:13:24:25:26' directoryd_mock.return_value = [ DirectoryRecord( id=imsi1, fields={ 'ipv4_addr': ip1, 'mac_addr': mac1, }, ), ] fake_cwf_setup(ue_mac_controller=self.ue_mac_controller, ) snapshot_verifier = SnapshotVerifier( self, self.BRIDGE, self.service_manager, 'default_flows', include_stats=False, ) with snapshot_verifier: pass setup_ue_mac_request = SetupUEMacRequest( requests=[ UEMacFlowRequest( sid=SIDUtils.to_pb(imsi1), mac_addr=mac1, msisdn='123456', ap_mac_addr=ap_mac_addr1, ap_name='magma', pdp_start_time=1, ), UEMacFlowRequest( sid=SIDUtils.to_pb(imsi2), mac_addr=mac2, msisdn='654321', ap_mac_addr=ap_mac_addr2, ap_name='amgam', pdp_start_time=9, ), ], epoch=global_epoch, ) fake_cwf_setup( ue_mac_controller=self.ue_mac_controller, setup_ue_mac_request=setup_ue_mac_request, ) snapshot_verifier = SnapshotVerifier( self, self.BRIDGE, self.service_manager, 'recovery_flows', include_stats=False, ) with snapshot_verifier: pass