Backbone technology: plain IGP, LDP, RSVP-TE, SR-MPLS, SRv6; two new RSVP-TE routers
Each router is classed by the highest backbone it runs and has a vendor. Upgrades are paid one step at a time and any level paid for can run. Higher levels use less router CPU, label switching makes pass-through traffic cheaper, Auto-TE and RouteScript need RSVP-TE or above, and POPs whose routers can't run the backbone stay outside it. Mixed vendors at the top of what their routers can do get interop failures. Saves with Auto-TE keep the old rules; puzzles, Architect and scenarios are unaffected.
This commit is contained in:
parent
664dd24bbd
commit
70676d7bfb
33 changed files with 553 additions and 56 deletions
175
tests/backbone-core.test.js
Normal file
175
tests/backbone-core.test.js
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const start = "ACT.start({});S.cash=1e9;S.lvl=13;S.nextFail=1e9;S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0";
|
||||
const g = n => `RG.findIndex(r=>r.n===${JSON.stringify(n)})`;
|
||||
|
||||
test('every router is classed by the highest backbone it runs', () => {
|
||||
const { ev, errors } = load();
|
||||
const want = {
|
||||
0: ['Rusty Router 9000', 'Edge Lord 400', 'Sonic the Whitebox 32'],
|
||||
1: ['Mikrowtik CCR', 'Mikrowtik CCR 3.2T'],
|
||||
2: ['Chonk 800', 'Brocadabra MLX-16', 'Extremely Networks SLX 9740'],
|
||||
3: ['Absolute Unit 1.6T', 'Arrrhipster 7280R', 'Arrrhipster 7800R', 'Arrrhipster 7800R5'],
|
||||
4: ['Absolute Unit 3.2T', 'Disco 8K', 'Disco 8K Ultra', 'Knockia 7750', 'Knockia 7950 XRS', 'Sonic the Whitebox 64', 'The Router at the End of the Universe'],
|
||||
};
|
||||
for (const [lv, names] of Object.entries(want)) for (const n of names) assert.equal(ev(`RG[${g(n)}].cr`), +lv, n);
|
||||
assert.equal(ev('RG.length'), Object.values(want).flat().length, 'every model is classed');
|
||||
assert.equal(ev("RG.filter(r=>r.v==='arrrhipster').some(r=>r.cr>=4)"), false, 'no Arrrhipster runs SRv6');
|
||||
assert.equal(ev("RG.filter(r=>r.v==='disco'||r.v==='knockia').every(r=>r.cr===4)"), true, 'every Disco and Knockia does');
|
||||
// Everything below its top, except the whitebox that does SRv6 natively and no MPLS at all.
|
||||
assert.equal(ev(`[0,1,2,3,4].map(L=>rgCore(${g('Disco 8K')},L)).join()`), 'true,true,true,true,true');
|
||||
assert.equal(ev(`[0,1,2,3,4].map(L=>rgCore(${g('Sonic the Whitebox 64')},L)).join()`), 'true,false,false,false,true');
|
||||
assert.equal(ev(`[0,1,2].map(L=>rgCore(${g('Mikrowtik CCR')},L)).join()`), 'true,true,false');
|
||||
// The two new ones go at the end, so saved POPs keep their models.
|
||||
assert.equal(ev(g('Brocadabra MLX-16')), ev('RG.length') - 2);
|
||||
assert.equal(ev("RG[RG_TOP].n"), 'The Router at the End of the Universe');
|
||||
assert.equal(ev("RG_ART.length"), ev("RG.length"), 'a picture for each');
|
||||
assert.equal(ev("mainRG(1)"), ev(g('Edge Lord 400')), 'the default upgrade path is unchanged');
|
||||
assert.equal(ev(`PZ_RG.includes(${g('Brocadabra MLX-16')})`), false, 'puzzles keep their router list');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a new network runs plain IGP: no Auto-TE until the backbone is upgraded, one step at a time', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
ev(start);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(S.core)')), { lv: 0, run: 0 });
|
||||
ev('ACT.buyTE()');
|
||||
assert.equal(ev('!!S.te'), false, 'no Auto-TE on plain IGP');
|
||||
ev("ACT.leftTab({t:'noc'})");
|
||||
assert.match(dom.window.document.body.textContent, /Backbone/);
|
||||
assert.match(dom.window.document.body.textContent, /Auto-TE needs an RSVP-TE/);
|
||||
const cash = ev('S.cash');
|
||||
ev('ACT.coreUp()');
|
||||
assert.equal(ev('S.core.lv'), 1);
|
||||
assert.equal(cash - ev('S.cash'), ev('CORE_COST[1]'));
|
||||
ev('ACT.buyTE()');
|
||||
assert.equal(ev('!!S.te'), false, 'LDP has no TE either');
|
||||
ev('ACT.coreUp()');
|
||||
assert.equal(ev('S.core.run'), 2);
|
||||
ev('ACT.buyTE()');
|
||||
assert.equal(ev('!!S.te'), true, 'RSVP-TE unlocks Auto-TE');
|
||||
// Customer levels gate each step.
|
||||
ev('S.lvl=3;ACT.coreUp()');
|
||||
assert.equal(ev('S.core.lv'), 2, 'SR-MPLS needs customer level 5');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('running a lower level is free, and Auto-TE and RouteScript pause below RSVP-TE', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + ";ACT.coreUp();ACT.coreUp();ACT.coreUp();ACT.buyTE();S.te.script='spill at 80%'");
|
||||
assert.equal(ev('S.core.lv'), 3);
|
||||
assert.ok(ev('!!teRules()'), 'RouteScript runs on SR-MPLS');
|
||||
const cash = ev('S.cash');
|
||||
ev('ACT.coreSet({v:1})');
|
||||
assert.equal(ev('S.core.run'), 1);
|
||||
assert.equal(ev('S.cash'), cash, 'free');
|
||||
assert.equal(ev('teRules()'), null, 'paused on LDP');
|
||||
ev('compute()');
|
||||
assert.equal(ev('R.teMoved'), 0);
|
||||
ev('ACT.coreSet({v:3})');
|
||||
assert.ok(ev('!!teRules()'), 'back on, script and all');
|
||||
ev('ACT.coreSet({v:4})');
|
||||
assert.equal(ev('S.core.run'), 3, 'cannot run what was never bought');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the core costs router CPU, less the higher it goes; POPs whose router cannot run it stay outside', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + `;ACT.buildPop({city:'ams'});S.pops.fra.rgen=${g('Disco 8K')}`);
|
||||
const cap = c => ev(`nodeCap('${c}')`);
|
||||
const base = cap('fra');
|
||||
const at = [];
|
||||
for (let L = 1; L <= 4; L++) { ev('ACT.coreUp()'); at.push(cap('fra') / base); }
|
||||
assert.deepEqual(at.map(x => +x.toFixed(2)), [0.9, 0.92, 0.95, 0.97], 'LDP costs the most CPU, SRv6 the least');
|
||||
assert.equal(ev("inCore('ams')"), false, 'a Rusty Router cannot run SRv6');
|
||||
assert.equal(cap('ams'), ev('RG[0].cap'), 'and pays no CPU for it');
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(coreOut())')), ['ams']);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('label switching: traffic passing through a POP costs its router less from LDP up', () => {
|
||||
const pass = lv => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + ";ACT.buildPop({city:'ams'});ACT.buildPop({city:'bru'});ACT.launchBB({city:'ams'});S.pops.ams.bb.d=150");
|
||||
ev(`for(const c in S.pops)S.pops[c].rgen=${g('Mikrowtik CCR')};S.pops.bru.rgen=${g('Chonk 800')};`);
|
||||
ev("const L=(a,b,t)=>{openLinkModal(a,b);ACT.buildLink({tier:t});closeModal();};L('ams','bru',1);L('bru','fra',1);ACT.buyTransit({city:'fra',net:'cog',tier:1})");
|
||||
for (let i = 0; i < lv; i++) ev('ACT.coreUp()');
|
||||
ev('compute()');
|
||||
assert.deepEqual(errors, []);
|
||||
return { load: ev("R.nodeLoad.bru||0"), served: ev('R.served') };
|
||||
};
|
||||
const ip = pass(0), ldp = pass(1);
|
||||
assert.ok(ip.served > 50 && Math.abs(ldp.served - ip.served) < 1, 'same traffic either way');
|
||||
assert.ok(ldp.load < ip.load * 0.7, `Brussels only passes it on: lighter with labels (${ldp.load.toFixed(1)} vs ${ip.load.toFixed(1)})`);
|
||||
});
|
||||
|
||||
test('interop failures: only with mixed vendors at the top of what some router can do', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + `;ACT.buildPop({city:'ams'});S.pops.fra.rgen=${g('Disco 8K')};S.pops.ams.rgen=${g('Knockia 7750')};`);
|
||||
ev("const L=(a,b,t)=>{openLinkModal(a,b);ACT.buildLink({tier:t});closeModal();};L('fra','ams',1)");
|
||||
for (let i = 0; i < 4; i++) ev('ACT.coreUp()');
|
||||
assert.ok(ev('coreIopRisk()') > 0, 'Disco and Knockia at SRv6, the top for both');
|
||||
ev('ACT.coreSet({v:3})');
|
||||
assert.equal(ev('coreIopRisk()'), 0, 'one step below: they get along');
|
||||
ev('ACT.coreSet({v:4})');
|
||||
ev(`S.pops.ams.rgen=${g('Disco 8K Ultra')}`);
|
||||
assert.equal(ev('coreIopRisk()'), 0, 'one vendor never fights itself');
|
||||
ev(`S.pops.ams.rgen=${g('Knockia 7750')};ACT.coreSet({v:2})`);
|
||||
assert.equal(ev('coreIopRisk()'), 0, 'RSVP-TE is below both');
|
||||
ev(`S.pops.fra.rgen=${g('Chonk 800')}`);
|
||||
assert.ok(ev('coreIopRisk()') > 0, 'a Chonk 800 at RSVP-TE is at its top');
|
||||
assert.ok(ev('coreIopRisk()') < ev('CORE_IOP[4]'), 'and RSVP-TE squabbles less than SRv6');
|
||||
ev("fireFailure('interop')");
|
||||
const inc = "S.inc.find(i=>i.type==='interop')";
|
||||
assert.ok(ev(`!!${inc}`), 'an interop incident');
|
||||
assert.equal(ev(`linkDown(S.links.find(l=>l.id===${inc}.ref))`), true, 'the link between the vendors is down');
|
||||
assert.equal(ev("incTitle('interop')"), 'Vendor interop failure');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a new game never gets interop incidents or CPU costs: the classic game is unchanged', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + `;ACT.buildPop({city:'ams'});S.pops.ams.rgen=${g('Knockia 7750')};S.pops.fra.rgen=${g('Disco 8K')}`);
|
||||
assert.equal(ev('coreIopRisk()'), 0);
|
||||
assert.equal(ev("nodeCap('ams')"), ev(`RG[${g('Knockia 7750')}].cap`));
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('saves: an old save with Auto-TE keeps it on the old rules, scenarios ignore the core, garbage is repaired', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start + ";ACT.coreUp();ACT.coreUp();ACT.buyTE()");
|
||||
ev("const s=JSON.parse(JSON.stringify(S));delete s.core;window.__t=migrate(s)");
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(__t.core)')), { lv: 2, run: 2, legacy: true }, 'Auto-TE bought before backbones: legacy RSVP-TE');
|
||||
ev("S=__t;compute()");
|
||||
assert.equal(ev('coreOn()'), false, 'the old rules');
|
||||
assert.equal(ev('coreTE()'), true, 'Auto-TE keeps running');
|
||||
ev('ACT.coreSet({v:2})');
|
||||
assert.equal(ev('coreOn()'), true, 'changing the backbone switches to the new rules');
|
||||
ev("const s=JSON.parse(JSON.stringify(S));delete s.core;delete s.te;window.__t=migrate(s)");
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(__t.core)')), { lv: 0, run: 0 }, 'no Auto-TE: plain IGP');
|
||||
ev("const s=JSON.parse(JSON.stringify(S));s.core={lv:9,run:-3,legacy:'yes'};window.__t=migrate(s)");
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(__t.core)')), { lv: 4, run: 0 });
|
||||
ev("S.scn={id:'x',rules:{},days:9};S.core={lv:0,run:0}");
|
||||
assert.equal(ev('coreOn()'), false, 'scenarios set TE up themselves');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the backbone panel and the router panels, on a phone too', () => {
|
||||
for (const w of [1280, 360]) {
|
||||
const { ev, dom, errors } = load();
|
||||
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip()");
|
||||
ev(`window.innerWidth=${w};` + start.replace('ACT.start({});', '') + `;ACT.buildPop({city:'ams'});S.pops.fra.rgen=${g('Disco 8K')};ACT.coreUp();ACT.coreUp();ACT.leftTab({t:'noc'});renderAll()`);
|
||||
const txt = dom.window.document.body.textContent;
|
||||
assert.match(txt, /RSVP-TE\/MPLS/, `${w}px`);
|
||||
assert.match(txt, /outside the backbone/, 'Amsterdam is left out');
|
||||
assert.match(txt, /Upgrade to SR-MPLS/);
|
||||
ev("UI.sel={type:'city',id:'fra'};UI.tab='links';UI.models=true;renderPanel()");
|
||||
const p = dom.window.document.getElementById('panelBody').textContent;
|
||||
assert.match(p, /Disco · backbone up to SRv6/);
|
||||
assert.match(p, /Brocadabra · backbone up to RSVP-TE\/MPLS/);
|
||||
assert.match(p, /Whitebox · backbone up to SRv6 · no MPLS, SRv6 only/);
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
||||
|
|
@ -100,7 +100,7 @@ const REAL_NAMES = [
|
|||
// cables
|
||||
'2Africa', 'Amitié', 'Dunant', 'EllaLink', 'Equiano', 'Grace Hopper', 'Hibernia Express', 'Jupiter', 'MAREA', 'PEACE', 'SEA-ME-WE 6',
|
||||
// vendors
|
||||
'Arista', 'Ciena', 'Cisco', 'Huawei', 'Infinera', 'Juniper', 'MikroTik', 'Nokia',
|
||||
'Arista', 'Brocade', 'Ciena', 'Cisco', 'Extreme Networks', 'Huawei', 'Infinera', 'Juniper', 'MikroTik', 'Nokia',
|
||||
];
|
||||
|
||||
const { ev, errors } = load();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function tour(ev) {
|
|||
for (const [label, src] of [['dash', 'ACT.dash({});ACT.dashClose()'], ['bank', 'ACT.bank();ACT.bankClose()'],
|
||||
['help', 'showHelp();closeModal()'], ['menu', 'ACT.menu();closeModal()'], ['reset', 'ACT.resetAsk();closeModal()'],
|
||||
['scenarios', 'scenarioModal();closeModal()'], ['trace', "traceModal('fra');closeModal()"],
|
||||
['route script', 'ACT.buyTE();ACT.teEdit();ACT.teExample();ACT.teCheck();closeModal()'],
|
||||
['route script', 'S.lvl=Math.max(S.lvl,3);S.cash+=1e6;ACT.coreUp();ACT.coreUp();ACT.buyTE();ACT.teEdit();ACT.teExample();ACT.teCheck();closeModal()'],
|
||||
['routers', "selectCity('fra');ACT.tab({t:'links'});ACT.models()"], ['vxc', "openVxcModal({from:'fra',to:'ams'});closeModal()"],
|
||||
['tutorial', 'S.tut=0;renderCoach();S.tut=3;renderCoach();S.tut=null;renderCoach()'], ['win', 'showWin()']]) step(label, src);
|
||||
const failSrc = ev('fireFailure.toString()');
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ test('Auto-TE spills overflow onto an alternate path when the shortest one is fu
|
|||
ev("for(const c of ['ams','lon','par'])ACT.buildPop({city:c});const L=(a,b,t,v)=>{UI.via=v||null;openLinkModal(a,b);ACT.buildLink({tier:t});closeModal();};L('fra','ams',0);L('ams','lon',1,'uly');L('fra','par',1);L('par','lon',1,'chn');ACT.buyTransit({city:'lon',net:'lvl',tier:1});compute()");
|
||||
const dem = ev("R.demand");
|
||||
assert.ok(ev("R.served") < dem - 1, 'without TE the 10G link caps it');
|
||||
ev("ACT.buyTE();compute()");
|
||||
// Auto-TE needs an RSVP-TE backbone, and routers that can run it: Chonk 800s.
|
||||
ev("for(const c in S.pops)S.pops[c].rgen=RG.findIndex(r=>r.n==='Chonk 800');ACT.coreUp();ACT.coreUp();ACT.buyTE();compute()");
|
||||
assert.ok(ev("R.served") > dem * 0.97, 'with TE nearly everything is served');
|
||||
assert.ok(ev("R.teMoved") > 1);
|
||||
assert.ok(ev("R.load[S.links.find(l=>l.a==='fra'&&l.b==='par').id]") > 1, 'the Paris path carries the overflow');
|
||||
|
|
@ -356,7 +357,7 @@ test('#31 #33 #38 connections overview lists every port, filters it and jumps to
|
|||
const { ev, dom, errors } = load();
|
||||
base(ev);
|
||||
const doc = dom.window.document;
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG.length-1;S.pops.ams.bb={d:200};compute()");
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG_TOP;S.pops.ams.bb={d:200};compute()");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'ams',net:'lvl',tier:1});ACT.buyIx({city:'ams~3',tier:1});ACT.buyIx({city:'ams',tier:1});compute()");
|
||||
ev("S.pni.push({id:uid(),city:'fra',net:'ggl',tier:1});R.demTo.nfx=1e4;ACT.cache({city:'fra',net:'nfx'});R.demTo.nfx=1e4;ACT.cache({city:'fra',net:'nfx'});compute()");
|
||||
const all = JSON.parse(ev('JSON.stringify(conns())'));
|
||||
|
|
@ -496,7 +497,7 @@ test('#42 the share card draws links across the date line on both edges of the m
|
|||
test('#45 unplugged optics go on a spares shelf, get reused for free, or sold for 40%', () => {
|
||||
const { ev, errors } = load();
|
||||
base(ev);
|
||||
ev("S.lvl=4;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG.length-1;S.links.push({id:'df1',a:'fra',b:'ams',kind:'df',km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
|
||||
ev("S.lvl=4;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG_TOP;S.links.push({id:'df1',a:'fra',b:'ams',kind:'df',km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
|
||||
const o = ev("Object.keys(OPT).find(k=>!chWhy(S.links[0],k))");
|
||||
const c0 = ev('S.cash');
|
||||
ev(`ACT.addCh({id:'df1',o:'${o}'})`);
|
||||
|
|
@ -521,7 +522,7 @@ test('#45 unplugged optics go on a spares shelf, get reused for free, or sold fo
|
|||
test('#35 your own trench can light another fiber pair once a ROADMaster is full', () => {
|
||||
const { ev, errors } = load();
|
||||
base(ev);
|
||||
ev("S.lvl=4;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG.length-1;S.pops.fra.routers=S.pops.ams.routers=RMAX;S.links.push({id:'own1',a:'fra',b:'ams',kind:'df',own:true,km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
|
||||
ev("S.lvl=4;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG_TOP;S.pops.fra.routers=S.pops.ams.routers=RMAX;S.links.push({id:'own1',a:'fra',b:'ams',kind:'df',own:true,km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
|
||||
assert.equal(ev("chMax(S.links[0])"), 64);
|
||||
ev("ACT.addPair({id:'own1'})");
|
||||
assert.equal(ev("S.links[0].pairs||1"), 1, 'not before the first pair is full');
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ test('the map draws at every zoom, with and without animations, without throwing
|
|||
test('RouteScript: parses safely, reports errors helpfully, and changes routing', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.buyTE();compute()");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.coreUp();ACT.coreUp();ACT.buyTE();compute()");
|
||||
let p = JSON.parse(ev("JSON.stringify(teParse('spill at 80%\\ncap transit cogentle at 3 gbps\\nprefer ix for goggle\\nnonsense here\\navoid transit for gogle'))"));
|
||||
assert.equal(p.errors.length, 2, 'the nonsense line and the typo fail');
|
||||
assert.match(p.errors[1], /Did you mean Goggle/, 'typos get a suggestion');
|
||||
|
|
@ -176,7 +176,7 @@ test('RouteScript: parses safely, reports errors helpfully, and changes routing'
|
|||
test('RouteScript BGP: local-pref and prepending move transit, protected customers go first, the optimizer drafts a script', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.buyTE();for(let i=0;i<30;i++)dayTick();compute()");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.coreUp();ACT.coreUp();ACT.buyTE();for(let i=0;i<30;i++)dayTick();compute()");
|
||||
const use = n => ev(`R.useT[S.transit.find(t=>t.net==='${n}').id]||0`);
|
||||
const p = JSON.parse(ev("JSON.stringify(teParse('prefer transit level tree\\navoid transit cogentle\\nprepend transit cogentle 2\\nprotect customers\\nprepend transit cogentle 9'))"));
|
||||
assert.equal(p.n, 4);
|
||||
|
|
@ -435,7 +435,7 @@ test('#114 Only Spätzle-IX can be won by peering alone', () => {
|
|||
test('RouteScript: help, ready-made scripts and the AI button', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.buyTE();compute()");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyTransit({city:'fra',net:'lvl',tier:1});ACT.coreUp();ACT.coreUp();ACT.buyTE();compute()");
|
||||
// every ready-made script parses on a real network and is listed in the help
|
||||
for (const id of JSON.parse(ev('JSON.stringify(TE_RECIPES.map(r=>r.id))')))
|
||||
assert.deepEqual(JSON.parse(ev(`JSON.stringify(teParse(TE_RECIPES.find(r=>r.id==='${id}').src().join('\\n')).errors)`)), [], id);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ test('Rackstar requests require enough Crowdflare traffic and a free router port
|
|||
test('Rackstar serves cacheable Crowdflare traffic locally and overflow uses transit', () => {
|
||||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
ev("S.pops.fra.rgen=RG.length-1;S.pops.fra.bb={d:200/NSH.cfl};ACT.buyTransit({city:'fra',net:'cog',tier:PORT.length-1});ACT.lagT({id:S.transit[0].id,d:1});ACT.lagT({id:S.transit[0].id,d:1});compute()");
|
||||
ev("S.pops.fra.rgen=RG_TOP;S.pops.fra.bb={d:200/NSH.cfl};ACT.buyTransit({city:'fra',net:'cog',tier:PORT.length-1});ACT.lagT({id:S.transit[0].id,d:1});ACT.lagT({id:S.transit[0].id,d:1});compute()");
|
||||
const transit = ev('R.useT[S.transit[0].id]');
|
||||
ev("ACT.cache({city:'fra',net:'cfl'})");
|
||||
assert.equal(ev('R.useCache[S.caches[0].id]'), ev('CACHE_CAP'), 'first box fills to 100G');
|
||||
|
|
@ -219,7 +219,7 @@ test('Amsterdam has FRIES-IX, with free 10G and 100G ports and paid larger ports
|
|||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(ixIdsIn('ams'))")), ['ams', 'ams~2', 'ams~3']);
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG.length-1;compute()");
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG_TOP;compute()");
|
||||
const cash = () => ev('S.cash');
|
||||
let c0 = cash();
|
||||
assert.equal(ev("ixPortMo('ams~3',0)"), 0, '10G port is free');
|
||||
|
|
@ -274,7 +274,7 @@ test('community exchanges are wired up in every city, and Barcelona has Catnip-I
|
|||
assert.equal(ev("ixName('bcn')"), 'Catnip-IX');
|
||||
for (const k of exchanges) {
|
||||
const c = k.split('~')[0];
|
||||
ev(`if(!S.pops.${c})ACT.buildPop({city:'${c}'});S.pops.${c}.rgen=RG.length-1;ACT.buyIx({city:'${k}',tier:1});ACT.rs({city:'${k}'})`);
|
||||
ev(`if(!S.pops.${c})ACT.buildPop({city:'${c}'});S.pops.${c}.rgen=RG_TOP;ACT.buyIx({city:'${k}',tier:1});ACT.rs({city:'${k}'})`);
|
||||
assert.equal(ev(`S.ixp['${k}']`), 1, `port at ${k}`);
|
||||
}
|
||||
ev('compute()');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const { load } = require('./harness');
|
|||
function setup(ev, cities = []) {
|
||||
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0");
|
||||
for (const city of cities) ev(`ACT.buildPop({city:'${city}'})`);
|
||||
ev('for(const p of Object.values(S.pops))p.rgen=RG.length-1;compute()');
|
||||
ev('for(const p of Object.values(S.pops))p.rgen=RG_TOP;compute()');
|
||||
}
|
||||
|
||||
test('bulk PNIs add missing shared POPs and upgrade smaller ports once, preserving existing orders and LAGs', () => {
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ const assert = require('node:assert/strict');
|
|||
const { load } = require('./harness');
|
||||
|
||||
function setup(ev) {
|
||||
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=RG.length-1;compute()");
|
||||
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=RG_TOP;compute()");
|
||||
}
|
||||
|
||||
test('global PNIs cover every eligible network and shared POP, including the long tail, in one transaction', () => {
|
||||
const { dom, ev, errors } = load();
|
||||
setup(ev);
|
||||
ev(`ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG.length-1;
|
||||
ev(`ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG_TOP;
|
||||
S.pni.push({id:'small',net:'cfl',city:'fra',tier:0,n:2,site:'ab',pref:'high'},
|
||||
{id:'big',net:'drz',city:'ams',tier:2},
|
||||
{id:'pending',net:'nfx',city:'fra',tier:1,ready:S.day+30});
|
||||
|
|
@ -139,7 +139,7 @@ test('the global batch, now in the Ops sheet, preserves scope, keyboard focus an
|
|||
test('bulk PNIs follow each network\'s own minimum port and lead time (pniMin, pniLead)', () => {
|
||||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG.length-1;compute();for(const n of NETS)R.demTo[n.id]=1e4");
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG_TOP;compute();for(const n of NETS)R.demTo[n.id]=1e4");
|
||||
// Ask everyone for 10G: networks that start at 100G get 100G, the rest get 10G.
|
||||
const b = JSON.parse(ev('JSON.stringify(pniBatch(null,0))'));
|
||||
const big = b.orders.filter(q => ev(`pniMin('${q.net}')`) > 0), small = b.orders.filter(q => ev(`pniMin('${q.net}')`) === 0);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ test('indexed routing matches the simple allocation loop across network changes'
|
|||
const changes = [
|
||||
'',
|
||||
"S.pni.forEach((p,i)=>p.pref=i%3===0?'high':i%3===1?'low':'normal')",
|
||||
"S.te={on:true,script:''}",
|
||||
"S.te={on:true,script:''};S.core={lv:2,run:2,legacy:true}",
|
||||
"S.te.script='prefer pni for goggle\\nspill at 80%\\navoid transit for netchill'",
|
||||
"S.te.script='prefer transit Cogentle\\nprepend transit Cogentle 2\\nprotect customers'",
|
||||
"S.ev.rpki={nets:['ggl','nfx'],until:S.day+3};S.ev.depeer=S.day+3",
|
||||
|
|
@ -66,7 +66,7 @@ test('indexed routing matches the simple allocation loop on a network of islands
|
|||
const changes = [
|
||||
'',
|
||||
"S.pni.forEach((p,i)=>p.pref=i%3===0?'high':i%3===1?'low':'normal')",
|
||||
"S.te={on:true,script:'prefer pni for goggle\\nspill at 80%'}",
|
||||
"S.te={on:true,script:'prefer pni for goggle\\nspill at 80%'};S.core={lv:2,run:2,legacy:true}",
|
||||
"S.ev.ddos={city:'fra',until:S.day+3,gbps:300,vec:'syn',entry:{k:'edge'}}",
|
||||
"S.links[0].cut=S.day+2",
|
||||
"S.te=null;S.links[0].cut=0;S.links.push({id:'join',a:'par',b:'pek',kind:'wave',tier:2,km:8000,cut:0,mo:100})",
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ test('fast routing gives exactly the same result as the plain path it replaces',
|
|||
for(const c of cs)for(const x of ixIdsIn(c)){try{ACT.buyIx({city:x,tier:1});}catch(e){}if(S.dk&&S.dk.q){S.dk.q=null;closeModal();}if(S.ixp[x]!==undefined&&!S.rs[x])ACT.rs({city:x});}
|
||||
compute();for(const n of NETS)for(const c of cs)if(n.pops.includes(c)&&peerOk(n.id,'pni',c).ok&&S.pni.length<150)S.pni.push({id:'p'+n.id+c,net:n.id,city:c,tier:1,n:1});
|
||||
for(const n of NETS.filter(n=>n.cache))for(const c of cs.slice(0,15))for(const k of [1,2])S.caches.push({id:'c'+k+n.id+c,city:c,net:n.id,site:'a'});
|
||||
if(S.pni[3])S.pni[3].pref='high';if(S.transit[1])S.transit[1].pref='low';S.te={on:true,day:0};S.nextFail=1e9;S.nextEvent=1e9;`);
|
||||
if(S.pni[3])S.pni[3].pref='high';if(S.transit[1])S.transit[1].pref='low';S.te={on:true,day:0};S.core={lv:2,run:2,legacy:true};S.nextFail=1e9;S.nextEvent=1e9;`);
|
||||
const sig = () => ev(`JSON.stringify({served:R.served,demand:R.demand,reach:R.reach,peered:R.peered,teMoved:R.teMoved,egT:R.egT,
|
||||
srv:Object.keys(R.citySrv).sort().map(c=>[c,R.citySrv[c]]),load:S.links.map(l=>R.load[l.id]||0),node:Object.keys(R.nodeLoad).sort().map(c=>[c,R.nodeLoad[c]]),
|
||||
t:Object.keys(R.useT).sort().map(k=>[k,R.useT[k]]),p:Object.keys(R.usePni).sort().map(k=>[k,R.usePni[k]]),ix:Object.keys(R.useIx).sort().map(k=>[k,R.useIx[k]]),c:Object.keys(R.useCache).sort().map(k=>[k,R.useCache[k]])})`);
|
||||
|
|
@ -326,11 +326,11 @@ test('Auto-TE routes around a full link exactly like the plain path', () => {
|
|||
plainCompute(ev);
|
||||
// Frankfurt reaches its only upstream in Amsterdam over a 10G wave, or the long way through Brussels on 800G.
|
||||
ev(`ACT.start({});S.cash=1e12;S.lvl=13;for(const g of GOALS)S.done[g.id]=0;for(const c of ['ams','bru'])ACT.buildPop({city:c});
|
||||
for(const c of ['fra','ams','bru']){S.pops[c].rgen=RG.length-1;S.pops[c].routers=RMAX;}if(!S.pops.fra.bb)ACT.launchBB({city:'fra'});S.pops.fra.bb.d=CITY.fra.P*0.8;
|
||||
for(const c of ['fra','ams','bru']){S.pops[c].rgen=RG_TOP;S.pops[c].routers=RMAX;}if(!S.pops.fra.bb)ACT.launchBB({city:'fra'});S.pops.fra.bb.d=CITY.fra.P*0.8;
|
||||
const L=(a,b,t)=>{UI.via=null;UI.lmode='wave';UI.route='main';openLinkModal(a,b);ACT.buildLink({tier:t});closeModal();};
|
||||
L('fra','ams',0);L('fra','bru',3);L('bru','ams',3);
|
||||
S.transit=[];const t=NETS.find(n=>n.price&&n.pops.includes('ams')&&n.type==='t1');ACT.buyTransit({city:'ams',net:t.id,tier:3});
|
||||
S.ixp={};S.pni=[];S.caches=[];S.te={on:true,day:0};S.nextFail=1e9;S.nextEvent=1e9;`);
|
||||
S.ixp={};S.pni=[];S.caches=[];S.te={on:true,day:0};S.core={lv:2,run:2,legacy:true};S.nextFail=1e9;S.nextEvent=1e9;`);
|
||||
const sig = () => ev('JSON.stringify({served:R.served,teMoved:R.teMoved,egT:R.egT,load:S.links.map(l=>R.load[l.id]||0),node:R.nodeLoad,t:R.useT})');
|
||||
for (const script of ['', 'spill at 70%']) {
|
||||
ev(`S.te.script=${JSON.stringify(script)}`);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ test('cache requests reject stale eligibility and insufficient port capacity ato
|
|||
|
||||
test('balanced caches keep serving when either site fails', t => {
|
||||
const { ev, errors } = setup(t);
|
||||
ev("Object.assign(S.pops.fra,{site2:true,routers:2,rgen:RG.length-1,bb:{d:5000}});S.caches=[{id:'one',city:'fra',net:'ggl'},{id:'two',city:'fra',net:'ggl'}];compute();ACT.utilityKit({city:'fra',cost:utilityKit('fra').cost})");
|
||||
ev("Object.assign(S.pops.fra,{site2:true,routers:2,rgen:RG_TOP,bb:{d:5000}});S.caches=[{id:'one',city:'fra',net:'ggl'},{id:'two',city:'fra',net:'ggl'}];compute();ACT.utilityKit({city:'fra',cost:utilityKit('fra').cost})");
|
||||
for (const site of ['a', 'b']) {
|
||||
ev(`S.inc=[{id:'site-failure',type:'site',ref:'fra',site:'${site}',until:S.day+2}];compute()`);
|
||||
assert.ok(ev('Object.values(R.useCache).reduce((a,b)=>a+b,0)') > 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue