Add Italy, Portugal, Greece and more US cities; rival IXes and a long tail of small peers

New POPs in Milan, Rome, Palermo, Lisbon, Athens, Atlanta, Denver, Phoenix,
Boston, Houston and Salt Lake City, with cables and local networks.

Big metros get challenger exchanges with overlapping but different members.
IX state is now keyed by exchange id instead of city. Sixty small networks
sit on random exchanges. EU ports are cheaper and see price wars, and
Voda-Phony moves to paid peering only.
This commit is contained in:
Frederic Jung 2026-10-24 06:29:19 +02:00
parent cc6d328511
commit 5e88e44a0a
No known key found for this signature in database
5 changed files with 285 additions and 62 deletions

View file

@ -101,7 +101,7 @@ test('LAGs add members, capacity and cost to transit, IX ports and PNIs', () =>
ev("const t=S.transit[0];window.__c0=S.cash;ACT.lagT({id:t.id,d:1});ACT.lagT({id:t.id,d:1});ACT.lagIx({city:'fra',d:1});compute()");
assert.equal(ev('S.transit[0].n'), 3);
assert.equal(ev("S.ixn.fra"), 2);
assert.equal(ev("__c0-S.cash"), 1500 * 2 + 1500, 'two transit members and one IX member were charged');
assert.equal(ev("__c0-S.cash"), 1500 * 2 + ev("ixPortMo('fra',1)"), 'two transit members and one IX member were charged');
assert.equal(ev("ixCap('fra')"), 190);
assert.equal(ev("R.cost.transit>0"), true);
ev("ACT.buyTransit({city:'fra',net:'cog',tier:2})");

View file

@ -56,7 +56,7 @@ test('remote peering is offered but costs more, gives less and gets refused more
const txt = () => ev("document.getElementById('panelBody').textContent");
ev("ACT.buyIx({city:'ams',tier:1});compute()");
assert.equal(ev("isRemote('ams')"), true);
assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*1.5)"), 'reseller markup');
assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*1.5*ixMul('ams'))"), 'reseller markup');
assert.equal(ev("ixCap('ams')"), ev("PORT[1].g*0.8"), 'oversubscribed port');
const refusers = JSON.parse(ev("JSON.stringify(ixMembers('ams').filter(id=>noRemote(id)&&!snub(id,'ams')))"));
assert.ok(refusers.length > 0, 'some members refuse remote peers');
@ -83,7 +83,7 @@ test('DE-KICKS hides prices, haggles, harmonises upwards, auto-enrolls add-ons a
assert.match(ev("document.getElementById('modalCard').textContent"), /Confidential/);
ev("S.dk.q.m=1.5;ACT.dkAccept()");
assert.equal(ev("S.ixp.fra"), 1);
assert.equal(ev("ixPortMo('fra',1)"), ev("Math.round(PORT[1].ix*1.5)"));
assert.equal(ev("ixPortMo('fra',1)"), ev("Math.round(PORT[1].ix*1.5*ixMul('fra'))"));
// haggling always moves something
ev("S.dk.q={city:'mad',tier:1,m:1.5,h:0}");
for (let i = 0; i < 3; i++) ev("if(S.dk.q)ACT.dkHaggle()");
@ -110,6 +110,6 @@ test('DE-KICKS hides prices, haggles, harmonises upwards, auto-enrolls add-ons a
ev("ACT.cancelIx({city:'fra'});ACT.cancelIx({city:'fra'})");
assert.equal(ev("S.ixp.fra"), undefined, 'second time you can actually leave');
ev("ACT.buildPop({city:'ams'})");
assert.equal(ev("ixPortMo('ams',1)"), ev("PORT[1].ix"), 'other IXs keep open pricing');
assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*ixMul('ams'))"), 'other IXs keep open pricing');
assert.deepEqual(errors, []);
});

View file

@ -229,3 +229,61 @@ test('the Gulf: Saudi licences, and a spat that cuts Qatar off from its neighbou
assert.equal(ev("cablesOk('cai','jed').length+cablesOk('jed','bom').length"), 0, 'the Red Sea crisis covers Egypt and Jeddah too');
assert.deepEqual(errors, []);
});
test('Italy, Portugal, Greece and more US cities are on the map and wired up', () => {
const { ev, errors } = load();
for (const c of ['mil', 'rom', 'pmo', 'lis', 'ath', 'atn', 'den', 'phx', 'bos', 'hou', 'slc']) {
assert.ok(ev(`!!CITY.${c}`), c);
assert.ok(ev(`NETS.filter(n=>n.price&&n.pops.includes('${c}')).length`) >= 2, `${c} has transit sellers`);
}
for (const [a, b] of [['lis', 'for'], ['lis', 'atn'], ['mil', 'pmo'], ['pmo', 'cai'], ['ath', 'ist'], ['bos', 'dub']])
assert.ok(ev(`cablesFor('${a}','${b}').length`) > 0, `${a}-${b} cable`);
assert.deepEqual(errors, []);
});
test('network ids are unique, and the long tail is small and spread over exchanges', () => {
const { ev } = load();
assert.equal(ev("new Set(NETS.map(n=>n.id)).size===NETS.length"), true);
const tail = ev("NETS.filter(n=>n.tail).length");
assert.ok(tail >= 50, `${tail} small peers`);
assert.ok(ev("NETS.filter(n=>n.tail).every(n=>n.share<=0.003&&n.pops.every(c=>CITY[c]&&!CITY[c].ixOnly))"));
assert.ok(ev("NETS.filter(n=>n.tail&&n.ix.some(x=>x.includes('~'))).length") >= 5, 'some only sit on challenger IXs');
});
test('several exchanges per city: overlapping members, cheaper challengers, separate ports', () => {
const { ev, errors } = load();
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;ACT.buildPop({city:'ams'})");
assert.deepEqual(JSON.parse(ev("JSON.stringify(ixIdsIn('ams'))")), ['ams', 'ams~2', 'ams~3']);
const a = JSON.parse(ev("JSON.stringify(ixMembers('ams'))")), b = JSON.parse(ev("JSON.stringify(ixMembers('ams~2'))"));
assert.ok(a.some(x => b.includes(x)), 'shared members');
assert.ok(b.some(x => !a.includes(x)) && a.some(x => !b.includes(x)), 'and different ones');
assert.ok(ev("ixPortMo('ams~2',1)") < ev("ixPortMo('ams',1)"), 'challenger is cheaper');
ev("ACT.buyIx({city:'ams~2',tier:1});ACT.rs({city:'ams~2'});compute()");
assert.equal(ev("S.ixp['ams~2']"), 1);
assert.equal(ev("S.ixp.ams"), undefined);
assert.ok(ev("ixSessions('ams~2').size") > 3);
assert.ok(ev("R.sessions") > 3);
ev("ACT.peerAll({city:'ams~2'})");
ev("selectCity('ams');ACT.tab({t:'peer'})");
const t = ev("document.getElementById('panelBody').textContent");
assert.match(t, /3 exchanges compete/);
assert.match(t, /NL-Nyx/);
ev("save();load2=JSON.parse(localStorage.getItem('sot-save-v1'));sanitize(load2)");
assert.equal(ev("load2.ixp['ams~2']"), 1, 'saves keep challenger ports');
ev("ACT.cancelIx({city:'ams~2'});ACT.cancelIx({city:'ams~2'})");
assert.equal(ev("S.ixp['ams~2']"), undefined);
assert.equal(ev("Object.keys(S.peers).some(k=>k.endsWith('@ams~2'))"), false);
assert.deepEqual(errors, []);
});
test('Voda-Phony only peers for money now, and EU price wars cut port prices', () => {
const { ev, errors } = load();
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;ACT.buildPop({city:'ams'})");
assert.equal(ev("NET.vdp.pol"), 'paid');
assert.equal(ev("peerOk('vdp','ix','ams').ok"), false);
assert.ok(ev("peerOk('vdp','pni','ams').fee") > 0);
assert.ok(ev("ixPortMo('ams',1)") < ev("PORT[1].ix"), 'EU ports are cheaper');
ev("ACT.buyIx({city:'ams',tier:1});const before=ixPortMo('ams',1);const r=Math.random;Math.random=()=>0;ixPriceWar(S.day);Math.random=r;window.__b=before");
assert.ok(ev("ixPortMo('ams',1)") < ev("__b"), 'price cut');
assert.deepEqual(errors, []);
});