mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	meas: Install the scenario command and test it
This commit is contained in:
		@@ -953,8 +953,10 @@ static int config_write_mncc_int(struct vty *vty)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	uint16_t meas_port;
 | 
						uint16_t meas_port;
 | 
				
			||||||
	char *meas_host;
 | 
						char *meas_host;
 | 
				
			||||||
 | 
						const char *meas_scenario;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	meas_feed_cfg_get(&meas_host, &meas_port);
 | 
						meas_feed_cfg_get(&meas_host, &meas_port);
 | 
				
			||||||
 | 
						meas_scenario = meas_feed_scenario_get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vty_out(vty, "mncc-int%s", VTY_NEWLINE);
 | 
						vty_out(vty, "mncc-int%s", VTY_NEWLINE);
 | 
				
			||||||
	vty_out(vty, " default-codec tch-f %s%s",
 | 
						vty_out(vty, " default-codec tch-f %s%s",
 | 
				
			||||||
@@ -966,6 +968,9 @@ static int config_write_mncc_int(struct vty *vty)
 | 
				
			|||||||
	if (meas_port)
 | 
						if (meas_port)
 | 
				
			||||||
		vty_out(vty, " meas-feed destination %s %u%s",
 | 
							vty_out(vty, " meas-feed destination %s %u%s",
 | 
				
			||||||
			meas_host, meas_port, VTY_NEWLINE);
 | 
								meas_host, meas_port, VTY_NEWLINE);
 | 
				
			||||||
 | 
						if (strlen(meas_scenario) > 0)
 | 
				
			||||||
 | 
							vty_out(vty, " meas-feed scenario %s%s",
 | 
				
			||||||
 | 
								meas_scenario, VTY_NEWLINE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return CMD_SUCCESS;
 | 
						return CMD_SUCCESS;
 | 
				
			||||||
@@ -1138,6 +1143,7 @@ int bsc_vty_init_extra(void)
 | 
				
			|||||||
	install_element(MNCC_INT_NODE, &mnccint_def_codec_f_cmd);
 | 
						install_element(MNCC_INT_NODE, &mnccint_def_codec_f_cmd);
 | 
				
			||||||
	install_element(MNCC_INT_NODE, &mnccint_def_codec_h_cmd);
 | 
						install_element(MNCC_INT_NODE, &mnccint_def_codec_h_cmd);
 | 
				
			||||||
	install_element(MNCC_INT_NODE, &mnccint_meas_feed_cmd);
 | 
						install_element(MNCC_INT_NODE, &mnccint_meas_feed_cmd);
 | 
				
			||||||
 | 
						install_element(MNCC_INT_NODE, &meas_feed_scenario_cmd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	install_element(CFG_LOG_NODE, &log_level_sms_cmd);
 | 
						install_element(CFG_LOG_NODE, &log_level_sms_cmd);
 | 
				
			||||||
	install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
 | 
						install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -296,6 +296,25 @@ class TestVTYNITB(TestVTYGenericBSC):
 | 
				
			|||||||
        res = self.vty.command("show network")
 | 
					        res = self.vty.command("show network")
 | 
				
			||||||
        self.assert_(res.startswith('BSC is on Country Code') >= 0)
 | 
					        self.assert_(res.startswith('BSC is on Country Code') >= 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def testMeasurementFeed(self):
 | 
				
			||||||
 | 
					        self.vty.enable()
 | 
				
			||||||
 | 
					        self.vty.command("configure terminal")
 | 
				
			||||||
 | 
					        self.vty.command("mncc-int")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        res = self.vty.command("write terminal")
 | 
				
			||||||
 | 
					        self.assertEquals(res.find('meas-feed scenario'), -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.vty.command("meas-feed scenario bla")
 | 
				
			||||||
 | 
					        res = self.vty.command("write terminal")
 | 
				
			||||||
 | 
					        self.assert_(res.find('meas-feed scenario bla') > 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						self.vty.command("meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890")
 | 
				
			||||||
 | 
					        res = self.vty.command("write terminal")
 | 
				
			||||||
 | 
					        self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890'), -1)
 | 
				
			||||||
 | 
					        self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz012345'), -1)
 | 
				
			||||||
 | 
					        self.assert_(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234') > 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestVTYBSC(TestVTYGenericBSC):
 | 
					class TestVTYBSC(TestVTYGenericBSC):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def vty_command(self):
 | 
					    def vty_command(self):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user