Glowball Sakura Lager: only its real hubs, dearer far from home, no transit for Australians
This commit is contained in:
parent
3458e43583
commit
7cfadaa6ae
14 changed files with 59 additions and 55 deletions
|
|
@ -2,13 +2,17 @@ const test = require('node:test');
|
|||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
test('Glowball Sakura Lager is a Tier 2 that is everywhere on the map but China and Russia', () => {
|
||||
test('Glowball Sakura Lager is a Tier 2 in the big hubs, not everywhere', () => {
|
||||
const { ev, errors } = load();
|
||||
assert.equal(ev("NET.gsl.name"), 'Glowball Sakura Lager');
|
||||
assert.equal(ev("NET.gsl.type"), 't2');
|
||||
assert.equal(ev("NET.gsl.pol"), 'open');
|
||||
assert.equal(ev("ALLC.filter(c=>c!=='pcn').every(c=>NET.gsl.pops.includes(c))"), true, 'a PoP in every city the big content networks reach');
|
||||
assert.equal(ev("NET.gsl.pops.includes('pcn')"), false, 'Pitcairn has no provider but you (#124)');
|
||||
const n = ev("NET.gsl.pops.length");
|
||||
assert.ok(n >= 20 && n <= 40, `a few dozen cities, like the real network (${n})`);
|
||||
for (const c of ['nyc', 'lon', 'fra', 'sin', 'tok', 'akl']) assert.ok(ev(`NET.gsl.pops.includes('${c}')`), `in ${c}`);
|
||||
assert.equal(ev("NET.gsl.pops.some(c=>['AF','SA'].includes(CITY[c].reg))"), false, 'nothing in Africa or South America');
|
||||
assert.equal(ev("NET.gsl.pops.includes('pcn')||NET.gsl.pops.includes('ivc')||NET.gsl.pops.includes('prr')"), false, 'not in the remote towns');
|
||||
assert.equal(ev("NET.gsl.ix.every(c=>NET.gsl.pops.includes(c))"), true, 'exchanges only where it has a PoP');
|
||||
assert.equal(ev("NET.gsl.pops.some(c=>CITY[c].cn||CITY[c].ru)"), false);
|
||||
assert.equal(ev("t1Need().some(n=>n.id==='gsl')"), false, 'not a Tier 1, so no Tier 1 club PNI is needed for it');
|
||||
assert.equal(ev("NET.gsl.up.every(u=>NET[u].type==='t1')"), true, 'it buys its own transit from Tier 1s');
|
||||
|
|
@ -18,25 +22,33 @@ test('Glowball Sakura Lager is a Tier 2 that is everywhere on the map but China
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('it sells transit in every city, Australia included, and sits on the exchanges', () => {
|
||||
test('it sells transit only where it is, and never to Australians, but peers on the big Australian exchanges', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({})");
|
||||
assert.equal(ev("ALLC.filter(c=>c!=='pcn').every(c=>sellsAt(NET.gsl,c))"), true);
|
||||
assert.equal(ev("sellsAt(NET.gsl,'ivc')&&sellsAt(NET.gsl,'prr')"), true, 'the small towns nobody else sells transit in');
|
||||
assert.equal(ev("CITIES.filter(c=>c.au).every(c=>sellsAt(NET.gsl,c.id))"), true, 'every Australian city');
|
||||
assert.equal(ev("NET.gsl.pops.filter(c=>!CITY[c].au).every(c=>sellsAt(NET.gsl,c))"), true);
|
||||
assert.equal(ev("Object.keys(CITY).filter(c=>!NET.gsl.pops.includes(c)).some(c=>sellsAt(NET.gsl,c))"), false, 'nowhere else');
|
||||
assert.equal(ev("sellsAt(NET.gsl,'ivc')||sellsAt(NET.gsl,'prr')"), false, 'the remote towns stay without transit');
|
||||
assert.equal(ev("Object.keys(CITY).filter(c=>CITY[c].au).some(c=>sellsAt(NET.gsl,c))"), false, 'no transit for Australians');
|
||||
assert.equal(ev("AU_SELLERS.includes('gsl')"), false);
|
||||
assert.equal(ev("ixMembers('fra').includes('gsl')&&ixMembers('lon').includes('gsl')"), true);
|
||||
assert.equal(ev("ixMembers('syd').includes('gsl')"), true, 'Australian exchanges follow auIx');
|
||||
assert.equal(ev("ixMembers('adl').includes('gsl')"), false);
|
||||
assert.equal(ev("ixMembers('lag').includes('gsl')"), false, 'not on exchanges where it has no PoP');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('in Australia it is dear, like everything there, but cheaper than Telstraya', () => {
|
||||
test('far from home it costs more than the locals, so it is never the cheap way in', () => {
|
||||
const { ev, errors } = load();
|
||||
const per = (net, c) => ev(`NET.${net}.price*regionMult('${c}')`);
|
||||
assert.ok(per('gsl', 'syd') > per('gsl', 'fra'), 'dearer at home in Sydney than in Frankfurt');
|
||||
assert.ok(per('gsl', 'syd') < per('tsy', 'syd'), 'but cheaper than Telstraya');
|
||||
ev("ACT.start({});S.cash=1e8;ACT.buildPop({city:'syd'});ACT.buyTransit({city:'syd',net:'gsl',tier:1});compute()");
|
||||
assert.equal(ev("S.transit.filter(t=>t.net==='gsl'&&t.city==='syd').length"), 1, 'the order went through');
|
||||
ev("ACT.start({})");
|
||||
const price = (net, c) => ev(`NET.${net}.price*netMult(NET.${net},'${c}')`);
|
||||
assert.equal(price('gsl', 'nyc'), 5, 'its own price at home in the US');
|
||||
assert.ok(price('gsl', 'sin') > ev("NET.gsl.price*regionMult('sin')"), 'a markup in Asia on top of the regional price');
|
||||
assert.ok(price('gsl', 'akl') > ev("NET.gsl.price*regionMult('akl')"), 'and in New Zealand');
|
||||
assert.equal(ev("NET.gsl.pops.filter(c=>sellsAt(NET.gsl,c)).some(c=>{const p=n=>n.price*netMult(n,c);return NETS.some(n=>n.id!=='gsl'&&sellsAt(n,c))&&p(NET.gsl)<Math.min(...NETS.filter(n=>n.id!=='gsl'&&sellsAt(n,c)).map(p));})"), false, 'never the cheapest seller in any of its cities');
|
||||
// The bill uses the same price as the panel.
|
||||
ev("S.cash=1e8;ACT.buildPop({city:'sin'});ACT.buyTransit({city:'sin',net:'gsl',tier:1});compute()");
|
||||
const t = "S.transit.find(t=>t.net==='gsl')";
|
||||
assert.equal(ev(`transitMo(${t},100)`), ev(`Math.max(100,PORT[${t}.tier].g*0.2)*NET.gsl.price*S.priceMul*netMult(NET.gsl,'sin')+PORT[${t}.tier].tmo`), 'billed with the markup');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
@ -64,20 +76,22 @@ test('it takes a PNI and open peering at an exchange, and carries its own traffi
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('networks on every continent buy their transit from it, so a PNI with it reaches them', () => {
|
||||
test('networks in its own regions buy their transit from it, so a PNI with it reaches them; none in Australia', () => {
|
||||
const { ev, errors } = load();
|
||||
// Each downstream's home continent is where most of its PoPs are.
|
||||
const home = JSON.parse(ev(`JSON.stringify(PNI_NETS.gsl.slice(1).map(id=>{const c={};for(const p of NET[id].pops){const r=CITY[p].reg;c[r]=(c[r]||0)+1;}return Object.entries(c).sort((a,b)=>b[1]-a[1])[0][0];}))`));
|
||||
for (const r of ['AF', 'AM', 'AS', 'EU', 'OC', 'SA']) assert.ok(home.filter((x) => x === r).length >= 3, `${r} has at least three downstreams`);
|
||||
for (const r of ['AM', 'AS', 'EU']) assert.ok(home.filter((x) => x === r).length >= 3, `${r} has at least three downstreams`);
|
||||
for (const r of ['AF', 'SA']) assert.equal(home.filter((x) => x === r).length, 0, `none in ${r}, where it has no PoPs`);
|
||||
assert.equal(ev("PNI_NETS.gsl.slice(1).some(id=>NET[id].pops.filter(c=>CITY[c].au).length>NET[id].pops.length/2)"), false, 'no Australian downstreams: no back door into Australia');
|
||||
assert.equal(ev("PNI_NETS.gsl.slice(1).every(id=>NET[id].up.includes('gsl')&&new Set(NET[id].up).size===NET[id].up.length)"), true);
|
||||
assert.equal(ev("PNI_NETS.gsl.some(id=>NET[id].type==='t1'||NET[id].cn)"), false);
|
||||
assert.equal(ev("PNI_NETS.gsl.slice(1).some(id=>merged(id)||MERGERS.some(m=>m.id===id))"), false, 'none of them is about to be bought');
|
||||
// Their own upstreams still reach them: nothing was replaced, only added.
|
||||
assert.equal(ev("NET.pes.up.join()"), 'cog,lvl,gsl');
|
||||
// One PNI with it carries a downstream's traffic as well as its own (a 100G port: 25 networks share it).
|
||||
// One PNI with it carries a downstream's traffic as well as its own (one port, shared by it and its downstreams).
|
||||
ev("ACT.start({});S.cash=1e8;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});S.pops.fra.bb.d=400;ACT.pni({city:'fra',net:'gsl',tier:1});for(const p of S.pni)p.ready=0;compute()");
|
||||
assert.ok(ev("(R.netEg.pes||{}).p") > 0, 'Pessimum is reached over the PNI with its upstream');
|
||||
assert.ok(ev("(R.netEg.abb||{}).p") > 0, 'so is Aussie Boyband');
|
||||
assert.equal(ev("(NET.abb.up||[]).includes('gsl')"), false, 'Aussie Boyband does not buy from it');
|
||||
ev("S.pni=[];compute()");
|
||||
assert.equal(ev("(R.netEg.pes||{}).p||0"), 0, 'and not without it');
|
||||
assert.deepEqual(errors, []);
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ test('a Tier 1 reaches every Latin American and African network through the carr
|
|||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});S.transit=[];S.ixp={};S.pni=[];for(const n of t1Need())S.pni.push({id:n.id,net:n.id,city:'fra',tier:0});compute()");
|
||||
for (const n of ['oio', 'tmt', 'bsn', 'mvs', 'llt', 'ant', 'tgo', 'liq', 'scm', 'agc', 'djt', 'mtx', 'art', 'eth', 'mrc']) {
|
||||
assert.equal(ev(`NET.${n}.up.some(id=>NET[id].type==='t1')`), true, `${n} buys from a Tier 1`);
|
||||
assert.equal(ev(`NET.${n}.up.every(id=>NET[id].type==='t1')`), true, `${n} buys from Tier 1s`);
|
||||
assert.equal(ev(`R.reachable.${n}`), true, `${n} is reachable`);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
|
|
@ -708,7 +708,7 @@ test('Australian peering follows PeeringDB: IX Straya and At-The-Edge IX in Sydn
|
|||
assert.ok(hba.includes('cfl') && hba.includes('voc') && !hba.includes('nfx'), 'Hobart: Crowdflare and Hocus Pocus, but no NetChill');
|
||||
assert.ok(JSON.parse(ev("JSON.stringify(ixMembers('fra'))")).includes('nfx'), 'networks on every IX elsewhere are unchanged outside Australia');
|
||||
const sellers = JSON.parse(ev("JSON.stringify(NETS.filter(n=>CITIES.some(c=>c.au&&sellsAt(n,c.id))).map(n=>n.id).sort())"));
|
||||
assert.deepEqual(sellers, ['cog', 'drz', 'gsl', 'lvl', 'ntt', 'sgt', 'spl', 'tsy', 'voc'], 'only carriers that really sell transit in Australia, and Glowball Sakura Lager by design');
|
||||
assert.deepEqual(sellers, ['cog', 'drz', 'lvl', 'ntt', 'sgt', 'spl', 'tsy', 'voc'], 'only carriers that really sell transit in Australia');
|
||||
assert.ok(!ev("NET.ntt.pops.includes('per')"), 'NTT is only in Sydney');
|
||||
assert.ok(ev("['dsp','fnt','pft'].every(n=>NET[n].pops.includes('syd')&&!sellsAt(NET[n],'syd'))"), 'Pacific carriers backhaul to Sydney but do not sell transit there');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue