Restore what the merge from main dropped from the carrier's own transit port
The merge kept main's version of compute(), the link actions and panels, the traceroute exit list and the CHANGELOG, so the city panel called a carryCtl() that no longer existed and routing never ranked a carrier's own port. Put the ranking back into compute() on top of the current rank lists and island split, along with setCarry, carryCtl, the traceroute carry flag, the reference loop in the routing test and the CHANGELOG bullet. Drop a stale label main had removed and sort the dictionaries. The tests follow main too: saves are read from their slot, RouteScript needs the core to run, Not That Telecom stands in for Cogentle (whose share is now small), and the flood test uses a smaller sacrificial PNI and IX flood because a carrier's own traffic now takes its share of the one transit port first.
This commit is contained in:
parent
296de1d946
commit
d9868a3757
14 changed files with 34 additions and 23 deletions
|
|
@ -11,7 +11,7 @@ function trExits(net){const day=S.day,ev=S.ev,leak=ev.leak&&ev.leak.until>day?ev
|
|||
// A peer's customer cone (#85): one AS hop more, so tried after direct peering and before transit, as in compute().
|
||||
for(const p of S.pni)if(CONE_S[p.net].has(net)&&pniOn(p)&&popUp(p.city)&&liveN(p.city,p.site,p.n))out.push({k:'p',rank:p.net===net?1:CONE_RANK,via:p.net===net?null:p.net,city:p.city,pref:p.pref||'normal',lab:tr('common.pni_with_net',{net:NET[p.net].name}),used:R.usePni[p.id]||0,cap:liveCap(pniG(p),p.city,p.site,p.n)});
|
||||
for(const c in S.ixp){const ses=ixSessions(c),via=ses.has(net)?null:ANC[net].find(u=>ses.has(u))||null;if((ses.has(net)||via)&&(popUp(ixCity(c))||remoteCities().includes(ixCity(c)))&&!(ev.ixdown&&ev.ixdown[c]>day))out.push({k:'ix',rank:via?CONE_RANK:2,via,city:ixCity(c),id:c,pref:(S.ixPref&&S.ixPref[c])||'normal',lab:tr('common.ix_peering',{ix:ixName(c)}),used:R.useIx[c]||0,cap:ixCap(c)});}
|
||||
for(const t of S.transit)if(popUp(t.city)&&!(t.down>day)&&liveN(t.city,t.site,t.n)&&net!==leak&&!((ev.depeer>day||scnRule('spat'))&&t.net==='cog'&&net==='ggl'))out.push({k:'t',rank:3,city:t.city,pref:t.pref||'normal',lab:tr('traceroute.name_transit',{name:NET[t.net].name}),tnet:t.net,used:R.useT[t.id]||0,cap:liveCap(PORT[t.tier].g,t.city,t.site,t.n)});
|
||||
for(const t of S.transit)if(popUp(t.city)&&!(t.down>day)&&liveN(t.city,t.site,t.n)&&net!==leak&&!((ev.depeer>day||scnRule('spat'))&&t.net==='cog'&&net==='ggl'))out.push({k:'t',rank:3,city:t.city,pref:t.pref||'normal',carry:!!t.carry,lab:tr('traceroute.name_transit',{name:NET[t.net].name}),tnet:t.net,used:R.useT[t.id]||0,cap:liveCap(PORT[t.tier].g,t.city,t.site,t.n)});
|
||||
return out;}
|
||||
// coneChain(peer,net): [peer, …, net], the shortest walk down customer links (the network's up lists, read backwards).
|
||||
function coneChain(top,id){const prev={[id]:null},q=[id];while(q.length){const x=q.shift();if(x===top)break;for(const u of NET[x].up||[])if(NET[u]&&!(u in prev)){prev[u]=x;q.push(u);}}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function compute(){
|
|||
for(const t of S.transit){if(!popUp(t.city)||t.down>day||!liveN(t.city,t.site,t.n))continue;
|
||||
// AS-path prepending (#96) moves part of the port to a last-resort exit of its own.
|
||||
const cap=Math.min(liveCap(PORT[t.tier].g,t.city,t.site,t.n)*lagF(t),TRX&&TRX.cap[t.net]!==undefined?TRX.cap[t.net]:Infinity),pf=TRX&&TRX.prep[t.net]?PREPEND_F[TRX.prep[t.net]]:0;
|
||||
const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak&&!(snd&&NET[n].kr)};
|
||||
const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',carry:!!t.carry,lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak&&!(snd&&NET[n].kr)};
|
||||
E.push(ex);if(pf)E.push({...ex,cap:cap*pf,prep:true});}
|
||||
// `nets`: every network ok() can say yes to, so it need not be asked about the other hundred.
|
||||
for(const c in S.ixp){const ct=ixCity(c);if(!(popUp(ct)||remote.includes(ct))||(S.ev.ixdown&&S.ev.ixdown[c]>day)||!(S.myIx[c]?myIxLive(c):liveN(ct,(S.ixSite||{})[c],(S.ixn||{})[c])))continue;const set=ixSessions(c);R2.sessions+=set.size;
|
||||
|
|
@ -170,7 +170,12 @@ function compute(){
|
|||
const base=(e,n)=>e.pref==='low'?4:e.rank>0&&e.rank<3&&coneOf(e,n)?CONE_RANK:e.rank;
|
||||
// LOCAL_PREF on an upstream moves it ahead of or behind the other transits, never ahead of peering (#96).
|
||||
const eff=(e,n)=>{let r=base(e,n);if(TR){if(e.k==='t'&&TR.up[e.net])r=TR.up[e.net]==='prefer'?2.9:3.5;if(e.prep)r=4.4;if(e.k!=='c'&&TR.drain.has(e.city))r=4.6;const o=TR.net[n];if(o){if(o.prefer===e.k)r=0.5;else if(o.avoid===e.k)r=4.5;}}return r;};
|
||||
const RANKS=TR?[0,0.5,1,2,CONE_RANK,2.9,3,3.5,4,4.4,4.5,4.6]:[0,1,2,CONE_RANK,3,4];
|
||||
// A carrier's own port for traffic bound for it or for its customers (25-direct-egress.js): tried before plain transit, but
|
||||
// never over RouteScript, a Prefer-marked port or a port set to backup, which all keep the say they had. Such a port is
|
||||
// also an ordinary transit exit (rank 3), so POPs without one of its own can still use it.
|
||||
const hiAny=E.some(e=>e.k==='t'&&e.pref==='high');
|
||||
const dr=(e,n)=>{if(hiAny||e.k!=='t')return 0;const t=directTier(e.net,n);return t&&eff(e,n)===3?DIRECT_RANK[t][e.carry?0:1]:0;};
|
||||
const RANKS=TR?[0,0.5,1,2,CONE_RANK,2.9,2.92,2.93,2.94,2.95,3,3.5,4,4.4,4.5,4.6]:[0,1,2,CONE_RANK,2.92,2.93,2.94,2.95,3,4];
|
||||
// With `protect customers`, business flows take every rank first; home users get what is left.
|
||||
const PASSES=TR&&TR.protect?[x=>x.bz,x=>!x.bz]:null;
|
||||
// Each network's exits by the rank they route at (RouteScript can move an exit per network), in E's order.
|
||||
|
|
@ -179,7 +184,8 @@ function compute(){
|
|||
const idx=L=>{L.hi=L.some(e=>e.hp===0);L.at=new Map();for(const e of L){const h=L.at.get(e.ci);if(h)h.push(e);else L.at.set(e.ci,[e]);}};
|
||||
// Networks with the same exits at a rank share one list (LIST, by content), so what one flow learns serves them all.
|
||||
const LIST=new Map();for(let i=0;i<E.length;i++)E[i].xi=i;
|
||||
const byRank={},RSET=new Set();for(const id of NET_IDS){const m=byRank[id]={};for(const e of okBy[id]){const r=TR?eff(e,id):base(e,id);RSET.add(r);(m[r]||(m[r]=[])).push(e);}
|
||||
const byRank={},RSET=new Set();for(const id of NET_IDS){const m=byRank[id]={};for(const e of okBy[id]){const r=TR?eff(e,id):base(e,id);RSET.add(r);(m[r]||(m[r]=[])).push(e);
|
||||
const d=dr(e,id);if(d){RSET.add(d);(m[d]||(m[d]=[])).push(e);}}
|
||||
for(const r in m){const L=m[r],key=L.map(e=>e.xi).join(','),o=LIST.get(key);if(o){m[r]=o;continue;}
|
||||
let V=L;if(NCOMP>1){const cs=[];for(const e of L){const k=COMP[e.ci];if(k>=0)(cs[k]||(cs[k]=[])).push(e);}for(const s of cs)if(s)idx(s);V={cs};}else idx(L);LIST.set(key,V);m[r]=V;}}
|
||||
// The flow being routed, and from its POP: distances, arriving edges and the paths walked so far, by city index.
|
||||
|
|
@ -230,11 +236,14 @@ function compute(){
|
|||
const sortD=a=>{const n=a.length;if(n>24){a.sort(byDist);return;}for(let i=1;i<n;i++){const x=a[i];let j=i-1;while(j>=0&&byDist(a[j],x)>0){a[j+1]=a[j];j--;}a[j+1]=x;}};
|
||||
for(const pass of PASSES||[null])for(const rank of RANKS){
|
||||
if(!RSET.has(rank))continue;
|
||||
// A carrier's own port that is not set to carry only takes the traffic of the POP it sits in.
|
||||
const LOC=rank===DIRECT_RANK[1][1]||rank===DIRECT_RANK[2][1];
|
||||
// Index loops in here: plain for…of allocates an iterator per loop until V8 has optimised compute().
|
||||
for(let fi=0,FN=flows.length;fi<FN;fi++){f=flows[fi];
|
||||
if(f.rem<=1e-6||(rank===0&&!f.cache)||(pass&&!pass(f)))continue;
|
||||
Dv=SDi[f.ci];Pv=SPi[f.ci];PP=walked[f.ci]||(walked[f.ci]=[]);vis++;
|
||||
let lst=byRank[f.n][rank];if(!lst)continue;if(lst.cs){lst=lst.cs[COMP[f.ci]];if(!lst)continue;}
|
||||
if(LOC){G.length=0;const here=lst.at.get(f.ci);if(!here)continue;for(let h=0;h<here.length;h++){const e=here[h];if(e.used<e.cap&&!gone(e))G.push(e);}if(G.length)sendGroup(G,0,G.length);continue;}
|
||||
/* Groups are tried nearest first, preferred exits before the rest, in the order a stable sort of the usable
|
||||
exits gives. Exits only fill up once tried, so the usable ones stay the same until then. Nearly every flow
|
||||
fits in its first group: find that one with a scan (nothing is visited yet), and sort only what is left
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ Object.assign(ACT,{
|
|||
const w=pairW(key,l.km);S.pairMet[key]={k,v:clampM(k,k==='w'?w:w/(l.km+60))};metBlur();sfx('click');after();},
|
||||
metricSet:({id})=>{const l=S.links.find(x=>x.id===id),t=$('metIn');if(!l||!t)return;const key=edgeKey(l),c=pairCm(key);if(!c)return;const v=parseFloat(String(t.value).replace(',','.'));if(!Number.isFinite(v)){sfx('err');return;}
|
||||
t.blur();S.pairMet[key]={k:c.k,v:clampM(c.k,v)};sfx('click');after();},
|
||||
setCarry:({id,on})=>{const t=S.transit.find(x=>x.id===id);if(!t)return;if(on)t.carry=true;else delete t.carry;sfx('click');after();},
|
||||
setStandby:({id,on})=>{const l=S.links.find(x=>x.id===id);if(!l)return;if(on)l.standby=true;else delete l.standby;sfx('click');after();},
|
||||
goEgress:({city,k})=>{ACT.focusCity({city});UI.tab=k==='t'?'up':k==='l2'?'cust':k==='nni'?'links':'peer';renderPanel();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ function linkCheckModal(l){const t=linkTrial(l.id);if(!t)return;
|
|||
const title=t.split?tr('link_panels.this_backhoe_wins'):t.loss>.01?tr('link_panels.connected_but_tight'):tr('link_panels.one_backhoe_is_not_enough');
|
||||
openModal(`<div style="display:flex;align-items:center;justify-content:space-between;gap:10px"><h2>${tr('common.redundancy_check')}</h2><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div><p class="eyebrow">${esc(CITY[l.a].name)} ⇄ ${esc(CITY[l.b].name)} · ${dateStr(t.day)}</p><div class="inc" style="background:${t.split?'#FFE3E3':t.loss>.01?'#FFF6CF':'#EAF7EE'}"><div class="nm">${title}</div><p class="lead">${t.split?tr('link_panels.no_alternate_backbone_path_connects'):t.loss>.01?tr('link_panels.an_alternate_path_exists_but_current'):tr('link_panels.with_current_demand_and_routing_this')}</p><div class="kv"><span>${tr('link_panels.additional_traffic_lost')}</span><b>${fmtG(t.loss)}</b></div></div>${t.losses.length?`<h3>${tr('common.service_affected')}</h3>${t.losses.map(x=>`<div class="kv"><span>${esc(x.name)}</span><b>−${fmtG(x.g)}</b></div>`).join('')}`:''}${t.busy.length?`<h3>${tr('link_panels.full_links_during_the_test')}</h3>${t.busy.slice(0,6).map(x=>`<div class="kv"><span>${esc(x.name)}</span><b>${fmtG(x.g)} / ${fmtG(x.cap)}</b></div>`).join('')}`:''}<p class="note">${tr('link_panels.snapshot_only_one_selected_link')}</p><div class="btns">${btn(tr('common.close'),'closeModal',{},'ghost')}</div>`,'link-check');}
|
||||
function linkCheckControl(l){return `<section><h3>${tr('common.redundancy_check')}</h3><p class="note">${tr('link_panels.what_happens_if_this_link_fails')}</p>${btn(tr('common.check_redundancy'),'linkCheck',{id:l.id},'ghost sm',linkDown(l))}</section>`;}
|
||||
// At its own POP a carrier's port always takes that carrier's traffic (25-direct-egress.js). From POPs with no port of it, the
|
||||
// traffic goes to the nearest transit port, or across your network to this one. Only worth asking when something else could take it.
|
||||
function carryCtl(t){if(Object.keys(S.pops).length<2||!S.transit.some(x=>x.net!==t.net))return '';const n=esc(NET[t.net].name);
|
||||
return `<div class="btns"><span class="meta" style="align-self:center">${tr('link_panels.traffic_for_net',{net:n})}</span>${btn(tr('link_panels.nearest_port'),'setCarry',{id:t.id,on:0},t.carry?'ghost sm':'pink sm')}${btn(tr('link_panels.carry_here'),'setCarry',{id:t.id,on:1},t.carry?'pink sm':'ghost sm')}</div><div class="meta">${t.carry?tr('link_panels.every_pop_carries_net_s_traffic',{net:n}):tr('link_panels.at_this_pop_net_s_traffic_always',{net:n})}</div>`;}
|
||||
function trafficSection(l){
|
||||
const rec=R.ef[edgeKey(l)],n=pairLinks(l.a,l.b).length;
|
||||
let h=linkCheckControl(l)+`<section><h3>${tr('link_panels.what_s_on_this_link')}</h3>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue