net-sim: skip files missing on the card; /api/write accepts a full path

Live-testing against a UICC without the EPS files (no USIM service 85)
and without the Kc files showed the runner aborting when EPSLOCI/Kc were
absent.  write_binary/write_record now take an 'optional' flag: a missing
candidate file is logged as a skip step instead of failing the scenario
(store_epsnsc, real/dummy locations, churn and Kc writes).  Also allow
POST /api/write to select by 'path' like /api/select and /api/read (the
netsim live test needed it to restore the captured file values).
This commit is contained in:
2026-09-19 22:53:24 +03:00
parent 0d92ea8f24
commit 99183acc89
4 changed files with 66 additions and 16 deletions
+18
View File
@@ -310,6 +310,24 @@ class RunnerTests(unittest.TestCase):
with self.assertRaises(ValueError):
runner.run('nope')
def test_missing_files_are_skipped_not_fatal(self):
# A card without the EPS files / Kc (e.g. no USIM service 85): the
# scenario must still succeed, writing what exists and noting skips.
files = {'6F7E': FakeFileInfo(size=11), '6F73': FakeFileInfo(size=14),
'6F43': FakeFileInfo(size=2, data='27FF')}
lchan = FakeLchan(files)
app = SimpleNamespace(rs=SimpleNamespace(lchan=[lchan]))
srv = FakeSrv()
runner = netsim.NetSimRunner(srv, app, event_list=[3], sleep=lambda s: None)
out = runner.run('service_lost')
self.assertTrue(out['success'])
skipped = {s['file'] for s in out['steps'] if s['action'] == 'skip'}
for key in ('epsnsc', 'epsloci', 'kc', 'kcgprs'):
self.assertIn(key, skipped)
written = [w[1] for w in lchan.writes]
self.assertIn('6F7E', written)
self.assertIn('6F73', written)
if __name__ == '__main__':
unittest.main()