pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39711?usp=email )


Change subject: ASP loadsharing: vty: Add cmd 'show cs7 instance <0-15> as 
binding-table name AS_NAME'
......................................................................

ASP loadsharing: vty: Add cmd 'show cs7 instance <0-15> as binding-table name 
AS_NAME'

Similar to the one available in Cisco ITP, but output is organized
differently, printed indexes by eSLS to fit our implementation.

Change-Id: Ia2e16b541b229805be23971957f5f7edecf61ed1
---
M src/osmo_ss7_vty.c
M tests/vty/osmo_stp_test.vty
2 files changed, 184 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/11/39711/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 63b127c..4344ea2 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -2433,6 +2433,49 @@
        return show_as(vty, id, as_name, NULL);
 }

+DEFUN(show_cs7_as_bindingtable_name, show_cs7_as_bindingtable_name_cmd,
+       "show cs7 instance <0-15> as binding-table name AS_NAME",
+       SHOW_STR CS7_STR INST_STR INST_STR "Application Server (AS)\n"
+       "Display binding table\n"
+       "Look up AS with a given name\n"
+       "Name of the Application Server (AS)\n")
+{
+       int id = atoi(argv[0]);
+       const char *as_name = argv[1];
+       struct osmo_ss7_instance *inst;
+       struct osmo_ss7_as *as = NULL;
+
+       inst = osmo_ss7_instance_find(id);
+       if (!inst) {
+               vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+
+       if (as_name) {
+               as = osmo_ss7_as_find_by_name(inst, as_name);
+               if (!as) {
+                       vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
+                       return CMD_WARNING;
+               }
+       }
+
+       vty_out(vty, "Loadshare Seed  Normal ASP       Active  Alternative ASP  
Active%s", VTY_NEWLINE);
+       vty_out(vty, "--------------  ---------------  ------  ---------------  
------%s", VTY_NEWLINE);
+
+       for (unsigned int i = 0; i < ARRAY_SIZE(as->aesls_table); i++) {
+               struct osmo_ss7_as_esls_entry *e = &as->aesls_table[i];
+               vty_out(vty, "%-15u %-16s %-7s %-16s %-7s%s",
+                       i,
+                       e->normal_asp ? e->normal_asp->cfg.name : "-",
+                       e->normal_asp ? (osmo_ss7_asp_active(e->normal_asp) ? 
"Yes" : "No") : "-",
+                       e->alt_asp ? e->alt_asp->cfg.name : "-",
+                       e->alt_asp ? (osmo_ss7_asp_active(e->alt_asp) ? "Yes" : 
"No") : "-",
+                       VTY_NEWLINE);
+       }
+
+       return CMD_SUCCESS;
+}
+
 /***********************************************************************
  * SCCP addressbook handling
  ***********************************************************************/
@@ -3306,6 +3349,7 @@
        install_node(&as_node, NULL);
        install_lib_element_ve(&show_cs7_as_cmd);
        install_lib_element_ve(&show_cs7_as_name_cmd);
+       install_lib_element_ve(&show_cs7_as_bindingtable_name_cmd);
        install_lib_element(L_CS7_NODE, &cs7_as_cmd);
        install_lib_element(L_CS7_NODE, &no_cs7_as_cmd);
        install_lib_element(L_CS7_AS_NODE, &cfg_description_cmd);
diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty
index 81515c1..75f3eae 100644
--- a/tests/vty/osmo_stp_test.vty
+++ b/tests/vty/osmo_stp_test.vty
@@ -12,6 +12,7 @@
   show cs7 instance <0-15> asp-assoc-status name ASP_NAME
   show cs7 instance <0-15> as (active|all|m3ua|sua)
   show cs7 instance <0-15> as name AS_NAME
+  show cs7 instance <0-15> as binding-table name AS_NAME
   show cs7 instance <0-15> route [POINT_CODE]
   show cs7 instance <0-15> route-lookup POINT_CODE from POINT_CODE sls <0-15> 
[list-asps]
   show cs7 instance <0-15> sccp addressbook
@@ -37,6 +38,7 @@
   show cs7 instance <0-15> asp-assoc-status name ASP_NAME
   show cs7 instance <0-15> as (active|all|m3ua|sua)
   show cs7 instance <0-15> as name AS_NAME
+  show cs7 instance <0-15> as binding-table name AS_NAME
   show cs7 instance <0-15> route [POINT_CODE]
   show cs7 instance <0-15> route-lookup POINT_CODE from POINT_CODE sls <0-15> 
[list-asps]
   show cs7 instance <0-15> sccp addressbook
@@ -86,11 +88,12 @@
   sccp              Signalling Connection Control Part

 OsmoSTP# show cs7 instance 0 as ?
-  active  Display all active ASs
-  all     Display all ASs (default)
-  m3ua    Display all m3ua ASs
-  sua     Display all SUA ASs
-  name    Look up AS with a given name
+  active         Display all active ASs
+  all            Display all ASs (default)
+  m3ua           Display all m3ua ASs
+  sua            Display all SUA ASs
+  name           Look up AS with a given name
+  binding-table  Display binding table

 OsmoSTP# show cs7 instance 0 sccp ?
   addressbook  List all SCCP addressbook entries
@@ -414,6 +417,138 @@
 OsmoSTP(config-cs7-as)# do show cs7 instance 0 as name my-ass-not-exists
 % No AS 'my-ass-not-exists' found

+OsmoSTP(config-cs7-as)# do show cs7 instance 0 as binding-table name my-ass
+Loadshare Seed  Normal ASP       Active  Alternative ASP  Active
+--------------  ---------------  ------  ---------------  ------
+0               -                -       -                -
+1               -                -       -                -
+2               -                -       -                -
+3               -                -       -                -
+4               -                -       -                -
+5               -                -       -                -
+6               -                -       -                -
+7               -                -       -                -
+8               -                -       -                -
+9               -                -       -                -      
+10              -                -       -                -
+11              -                -       -                -
+12              -                -       -                -
+13              -                -       -                -
+14              -                -       -                -
+15              -                -       -                -
+16              -                -       -                -
+17              -                -       -                -
+18              -                -       -                -   
+19              -                -       -                -
+20              -                -       -                -
+21              -                -       -                -
+22              -                -       -                -
+23              -                -       -                -
+24              -                -       -                -
+25              -                -       -                -
+26              -                -       -                -
+27              -                -       -                -
+28              -                -       -                -
+29              -                -       -                -
+30              -                -       -                -
+31              -                -       -                -
+32              -                -       -                -
+33              -                -       -                -
+34              -                -       -                -
+35              -                -       -                -
+36              -                -       -                -
+37              -                -       -                -     
+38              -                -       -                -
+39              -                -       -                -
+40              -                -       -                -
+41              -                -       -                -
+42              -                -       -                -
+43              -                -       -                -
+44              -                -       -                -
+45              -                -       -                -
+46              -                -       -                -  
+47              -                -       -                -
+48              -                -       -                -
+49              -                -       -                -
+50              -                -       -                -
+51              -                -       -                -
+52              -                -       -                -
+53              -                -       -                -
+54              -                -       -                -
+55              -                -       -                -
+56              -                -       -                -
+57              -                -       -                -
+58              -                -       -                -
+59              -                -       -                -
+60              -                -       -                -
+61              -                -       -                -
+62              -                -       -                -
+63              -                -       -                -
+64              -                -       -                -
+65              -                -       -                -    
+66              -                -       -                -
+67              -                -       -                -
+68              -                -       -                -
+69              -                -       -                -
+70              -                -       -                -
+71              -                -       -                -
+72              -                -       -                -
+73              -                -       -                -
+74              -                -       -                - 
+75              -                -       -                -
+76              -                -       -                -
+77              -                -       -                -
+78              -                -       -                -
+79              -                -       -                -
+80              -                -       -                -
+81              -                -       -                -
+82              -                -       -                -
+83              -                -       -                -
+84              -                -       -                -      
+85              -                -       -                -
+86              -                -       -                -
+87              -                -       -                -
+88              -                -       -                -
+89              -                -       -                -
+90              -                -       -                -
+91              -                -       -                -
+92              -                -       -                -
+93              -                -       -                -   
+94              -                -       -                -
+95              -                -       -                -
+96              -                -       -                -
+97              -                -       -                -
+98              -                -       -                -
+99              -                -       -                -
+100             -                -       -                -
+101             -                -       -                -
+102             -                -       -                -
+103             -                -       -                -
+104             -                -       -                -
+105             -                -       -                -
+106             -                -       -                -
+107             -                -       -                -
+108             -                -       -                -
+109             -                -       -                -
+110             -                -       -                -
+111             -                -       -                -
+112             -                -       -                -     
+113             -                -       -                -
+114             -                -       -                -
+115             -                -       -                -
+116             -                -       -                -
+117             -                -       -                -
+118             -                -       -                -
+119             -                -       -                -
+120             -                -       -                -
+121             -                -       -                -  
+122             -                -       -                -
+123             -                -       -                -
+124             -                -       -                -
+125             -                -       -                -
+126             -                -       -                -
+127             -                -       -                -
+
 OsmoSTP(config-cs7-as)# asp my-asp
 OsmoSTP(config-cs7-as)# routing-key 0 3.2.1


--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/39711?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ia2e16b541b229805be23971957f5f7edecf61ed1
Gerrit-Change-Number: 39711
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>

Reply via email to