NCs should be /0 not /x

This commit is contained in:
Deon George 2023-12-13 12:13:47 +11:00
parent b9bc413b05
commit f6a6c13ca2
3 changed files with 14 additions and 22 deletions

View File

@ -70,7 +70,7 @@ class ZoneCheck extends Command
// NC address
if ($ao->role === Address::NODE_NC) {
if (($ao->node_id !== 0) && is_null($ao->hub_id) && ($ao->point_id === 0))
if (($ao->node_id === 0) && is_null($ao->hub_id) && ($ao->point_id === 0))
return 'OK';
else
return 'INVALID NC address';

View File

@ -190,7 +190,7 @@ class TestNodeHierarchy extends Seeder
'validated'=>TRUE,
'region_id'=>$rid,
'host_id'=>$hostid,
'node_id'=>7,
'node_id'=>0,
'point_id'=>0,
'system_id'=>$so->id,
'role'=>Address::NODE_NC,

View File

@ -63,28 +63,24 @@ class RoutingTest extends TestCase
private function session_zc(): void
{
// Add session info, and we have 51 children
$ao = Address::findFTN('101:0/0@a');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
}
private function session_rc(): void
{
// Add session info, and we have 51 children
$ao = Address::findFTN('100:1/0@a');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
}
private function session_nc(): void
{
// Add session info, and we have 51 children
$ao = Address::findFTN('100:10/7@a');
$ao = Address::findFTN('100:10/0@a');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
}
private function session_hub(): void
{
// Add session info, and we have 51 children
$ao = Address::findFTN('100:10/20@a');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
}
@ -159,7 +155,7 @@ class RoutingTest extends TestCase
$this->session_rc();
// A NCs parent should still be the RC
$ao = Address::findFTN('100:10/7@a');
$ao = Address::findFTN('100:10/0@a');
$this->assertEquals($ao->role,Address::NODE_NC);
$this->assertEquals('100:1/0.0@a',$ao->parent()->ftn);
}
@ -199,9 +195,7 @@ class RoutingTest extends TestCase
public function test_rc_nc_session_children()
{
$this->session_rc();
$ao = Address::findFTN('100:10/7@a');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
$this->session_nc();
$ao = Address::findFTN('100:1/0@a');
$this->assertCount(185-36,$ao->children());
@ -236,7 +230,7 @@ class RoutingTest extends TestCase
{
$this->session_nc();
$ao = Address::findFTN('100:10/7@a');
$ao = Address::findFTN('100:10/0@a');
$this->assertCount(35,$ao->children());
}
@ -254,15 +248,15 @@ class RoutingTest extends TestCase
$ao = Address::findFTN('100:1/0.0@a');
$this->assertCount(186-1-30-6,$ao->children());
$ao = Address::findFTN('100:11/7.0@a');
$ao = Address::findFTN('100:11/0.0@a');
$this->assertEquals('100:1/0.0@a',$ao->parent()->ftn);
// NC
$ao = Address::findFTN('100:10/7.0@a');
$ao = Address::findFTN('100:10/0.0@a');
$this->assertCount(36-1-6,$ao->children());
$ao = Address::findFTN('100:10/10.0@a');
$this->assertEquals('100:10/7.0@a',$ao->parent()->ftn);
$this->assertEquals('100:10/0.0@a',$ao->parent()->ftn);
// HC
$ao = Address::findFTN('100:10/20.0@a');
@ -275,16 +269,14 @@ class RoutingTest extends TestCase
public function test_complex_rc_nc_hc_us()
{
$setup = Setup::findOrFail(config('app.id'));
$ao = Address::findFTN('100:10/7.0@a');
$ao = Address::findFTN('100:10/0.0@a');
$setup->system_id = $ao->system_id;
$setup->save();
/*
*/
$this->session_rc();
//$this->session_nc();
$this->session_hub();
$ao = Address::findFTN('100:11/7.0');
$ao = Address::findFTN('100:11/0.0');
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
$ao = Address::findFTN('100:1/100.0@a');
@ -295,11 +287,11 @@ class RoutingTest extends TestCase
$ao = Address::findFTN('100:1/0.0@a');
$this->assertCount(186-36-36-1,$ao->children());
$ao = Address::findFTN('100:11/7.0@a');
$this->assertEquals('100:11/7.0@a',$ao->parent()->ftn);
$ao = Address::findFTN('100:11/0.0@a');
$this->assertEquals('100:11/0.0@a',$ao->parent()->ftn);
// NC
$ao = Address::findFTN('100:10/7.0@a');
$ao = Address::findFTN('100:10/0.0@a');
$this->assertCount(36-6-1,$ao->children());
$ao = Address::findFTN('100:10/10.0@a');