20181002_jeffrey - silenceuncrio/diary GitHub Wiki

0850

review

目前 M360 在等待以下工作項目

  • multiple locked pci
  • dual apn dns
  • LAN/WAN MAC address

盤一下 52XXZ 待作事項

  • RIPv1/v2
    • 沒有在 web 的選單出現
  • BGP
    • 已有 web ui
    • 待測
  • GRE
    • 已有 web ui
    • 待測

0905

進行 RIPv1/v2

先準備一台 M300 與 52XXZ 對測

52XXZ 先從 proscend 外層開始 build

cd /home/user
source proenv.sh
make

ok

0915

再進 proscend build image... ok

upgrade via uboot... run update_fullimage... ok

開機... run flash_flash... ok

52XXZ RIP 沒有在 web 的選單出現是因為 compile flag 沒打開

修改目前唯一一個 config profile - proscend/mconfig/configs/52XXZ/0_GENERIC/defconfig

@@ -140,7 +140,7 @@ PROSRC_ZEBRA=y
 # PROSRC_OSPF is not set
 # PROSRC_OSPF_2G is not set
 PROSRC_SMTP=y
-# PROSRC_RIP_2G is not set
+PROSRC_RIP_2G=y
 # PROSRC_EMMC is not set
 # PROSRC_CUSTOMIZE is not set
 # PROSRC_2APN is not set

透過 proscend 目錄下的 make menuconfig 確認 RIP 2G 有打開

image

在 proscend 目錄下重 build image

make clean
make

upgrade via web ui... ok

1100

rip_2g?act=config - ICOS_GetSetting fail

image

看一下 console

### module <system> init
### module <shdslbis> init
...
### module <rip> init
 Error: Module rip cfg init failure
...

看一下 log

root@52XXZ:~# cat /home/log/rip_2g.log
1515178816[20180105 19:0:16] [_init:414][Info]
1515178816[20180105 19:0:16] [_get_setting:484][Info] flag: 0
1515178816[20180105 19:0:16] [_verify_setting:549][Info]
1515178816[20180105 19:0:16] [_init:437][Error] Failed to get the current setting to init the rip_2g module
...

看一下相關 source code

static int _init(char *pCfgStr)
{
    _LOG_INFO("");

    struct stat st;

    if (stat(RIP_2G_ETC_DIR, &st) < 0)
    {
        mkdir(RIP_2G_ETC_DIR, 0755);
    }

    if (stat(RIP_2G_TMP_DIR, &st) < 0)
    {
        mkdir(RIP_2G_TMP_DIR, 0755);
    }

    if (access(RIP_2G_ETC_CFG_FILE, F_OK) != 0)
    {
        SysCopyFile(RIP_2G_FACTORY_CFG_FILE, RIP_2G_ETC_CFG_FILE);
    }

    rip_2g_t setting;

    if (_get_setting(OPFLAG_GET_CURRENT, 0, &setting, sizeof(setting)) != ICOS_SUCCESS)
    {
        _LOG_ERROR("Failed to get the current setting to init the rip_2g module");
        return ICOS_FAILURE;
    }

    IPTF_JOIN_AND_NEW(IPT_UC_APP_IN, RIP_2G_IPT_INPUT_CHAIN, NULL);
    IPTF_I("%s -p udp --dport %d -j ACCEPT", RIP_2G_IPT_INPUT_CHAIN, 520);

    return _apply(0, 0, &setting, sizeof(setting));
}

修一下

@@ -555,8 +555,7 @@ static int _verify_setting(int flag, int index, void* pStruct, int structSize)
         return ICOS_FAILURE;
     }

-
-
+    return ICOS_SUCCESS;
 }

upgrade via web ui... ok

check log

root@52XXZ:~# cat /home/log/rip_2g.log
1515180202[20180105 19:23:22] [_init:414][Info]
1515180202[20180105 19:23:22] [_get_setting:484][Info] flag: 0
1515180202[20180105 19:23:22] [_verify_setting:549][Info]
1515180202[20180105 19:23:22] [_get_setting:500][Debug] Getting JSON data from /etc/icos/rip_2g/rip_2g.json
1515180202[20180105 19:23:22] [_get_setting:508][Debug] jobj: { "mode": "off", "redistribute_kernel": "off", "redistribute_static": "off", "redistribute_connected": "off", "redistribute_ospf": "off", "redistribute_bgp": "off", "interfaces": [ ] }
1515180202[20180105 19:23:22] [_json_2_setting_handle:231][Debug] mode: 0
1515180202[20180105 19:23:22] [_json_2_setting_handle:239][Debug] redistribute_kernel: 0
1515180202[20180105 19:23:22] [_json_2_setting_handle:247][Debug] redistribute_static: 0
1515180202[20180105 19:23:22] [_json_2_setting_handle:255][Debug] redistribute_connected: 0
1515180202[20180105 19:23:22] [_json_2_setting_handle:263][Debug] redistribute_ospf: 0
1515180202[20180105 19:23:22] [_json_2_setting_handle:271][Debug] redistribute_bgp: 0
1515180202[20180105 19:23:22] [_apply:451][Info] flag: 0
1515180202[20180105 19:23:22] [_set_setting:521][Info] flag: 2
1515180202[20180105 19:23:22] [_verify_setting:549][Info]
1515180202[20180105 19:23:22] [_apply:463][Info] mode: 0

web page 有了

image

可以開測了

發現 52XXZ 上 zebraripd 的 daemon 都沒有跑起來

先 check 為什麼 52XXZ 上的 zebra 沒有跑起來

正常的 M300

bash-4.3# cat /home/log/zebra.log
1536149904[20180905 12:18:24] [_init:227][caller:254.353]in
1536149904[20180905 12:18:24] [_getSetting:180][caller:254.353]in
1536149904[20180905 12:18:24] [_callBack:135]attID:1, pAttValue:on
1536149904[20180905 12:18:24] [_callBack:136]res:0
1536149904[20180905 12:18:24] [_callBack:135]attID:2, pAttValue:Router
1536149904[20180905 12:18:24] [_callBack:136]res:0
1536149904[20180905 12:18:24] [_callBack:135]attID:3, pAttValue:zebra
1536149904[20180905 12:18:24] [_callBack:136]res:0
1536149904[20180905 12:18:24] [_apply:200][caller:254.353]in
1536149904[20180905 12:18:24] [_locSaveConfigTxt:93][pid:353]in
1536149904[20180905 12:18:24] [_prepare_config:54]_prepare_config

異常的 52XXZ

root@52XXZ:~# cat /home/log/zebra.log
1515181354[20180105 19:42:34] [_init:227][caller:726.766]in
1515181354[20180105 19:42:34] [_getSetting:180][caller:726.766]in
1515181354[20180105 19:42:34] [_callBack:135]attID:1, pAttValue:on
1515181354[20180105 19:42:34] [_callBack:136]res:0
1515181354[20180105 19:42:34] [_callBack:135]attID:2, pAttValue:Router
1515181354[20180105 19:42:34] [_callBack:136]res:0
1515181354[20180105 19:42:34] [_callBack:135]attID:3, pAttValue:zebra
1515181354[20180105 19:42:34] [_callBack:136]res:0
1515181354[20180105 19:42:34] [_apply:200][caller:726.766]in
1515181354[20180105 19:42:34] [_locSaveConfigTxt:93][pid:766]in
1515181355[20180105 19:42:35] [_prepare_config:54]_prepare_config
1515181355[20180105 19:42:35] [_prepare_config:59]Failed to open file: '/etc/quagga/zebra.conf'

52XXZ 相關的 source code 如下

    FILE *fp = fopen(ZEBRA_CONF_FILE, "w");
    if (fp == 0)
    {
        CPRT("Failed to open file: '%s'\n", ZEBRA_CONF_FILE);
        return ICOS_FAILURE;
    }

看來是 /etc/quagga/zebra.conf 這個位置需要作調整

M300

bash-4.3# touch /etc/quagga/hello
bash-4.3#

52XXZ

root@52XXZ:~# touch /etc/quagga/hello
touch: /etc/quagga/hello: Read-only file system
root@52XXZ:~#

問一下其他同事都搬到哪邊去

搬到 /etc/icos/ 下即可

1300

先修一下 proscend/prosrc/icos/icoslib/zebra/zebra.c

@@ -22,7 +22,7 @@
 #define ZEBRA_DAEMON_PATH   "/usr/sbin/zebra"
 #define ZEBRA_DAEMON         "zebra"
 #define ZEBRA_ARGV           "-d -u root -f %s"
-#define ZEBRA_CONF_FILE      "/etc/quagga/zebra.conf"
+#define ZEBRA_CONF_FILE      "/etc/icos/quagga_zebra.conf"
 #define ZEBRA_CONF_FORMAT \
     "hostname %s\n" \
     "password %s\n"
@@ -53,7 +53,7 @@ static int _prepare_config(sZebraConfig *config)
 {
     CPRT("_prepare_config\n");

-    FILE *fp = fopen(ZEBRA_CONF_FILE, "w");
+    FILE *fp = fopen(ZEBRA_CONF_FILE, "w+");
     if (fp == 0)
     {
         CPRT("Failed to open file: '%s'\n", ZEBRA_CONF_FILE);
@@ -208,13 +208,13 @@ static int _apply(int flag, int index, void* pStruct, int structSize)

     if (ATTVAL_MODE_ON == config->mode)
     {
-        system("/usr/sbin/quagga.init stop zebra 1>/dev/null 2>&1");
+        system("killall zebra 1>/dev/null 2>&1");
         _prepare_config(config);
-        system("/usr/sbin/quagga.init start zebra 1>/dev/null 2>&1");
+        system("zebra -d -u root -f /etc/icos/quagga_zebra.conf");
     }
     else
     {
-        system("/usr/sbin/quagga.init stop zebra 1>/dev/null 2>&1");
+        system("killall zebra 1>/dev/null 2>&1");
     }

     return ICOS_SUCCESS;

build image... ok

upgrade via web ui... ok

1400

zebra log 看起來沒問題

root@52XXZ:~# cat /home/log/zebra.log
1515186897[20180105 21:14:57] [_init:227][caller:726.766]in
1515186897[20180105 21:14:57] [_getSetting:180][caller:726.766]in
1515186897[20180105 21:14:57] [_callBack:135]attID:1, pAttValue:on
1515186897[20180105 21:14:57] [_callBack:136]res:0
1515186897[20180105 21:14:57] [_callBack:135]attID:2, pAttValue:Router
1515186897[20180105 21:14:57] [_callBack:136]res:0
1515186897[20180105 21:14:57] [_callBack:135]attID:3, pAttValue:zebra
1515186897[20180105 21:14:57] [_callBack:136]res:0
1515186897[20180105 21:14:57] [_apply:200][caller:726.766]in
1515186897[20180105 21:14:57] [_locSaveConfigTxt:93][pid:766]in
1515186897[20180105 21:14:57] [_prepare_config:54]_prepare_config

不過 ps aux 卻沒看到 zebra 這個 daemon

先確認一下 zebra daemon 啟動的方式

以下的方式可以叫起來 zebra

root@52XXZ:~# zebra -d -u root
root@52XXZ:~# ps aux | grep zebra
root      4890  0.0  0.5   2016   720 ?        Ss   22:08   0:00 zebra -d -u root
root      5060  0.0  0.2   1812   368 ?        S    22:09   0:00 grep zebra

不過如果不透過 -f 來指定 configuration file 的話預設的 configuration file 是 /etc/quagga/zebra.conf

root@52XXZ:~# cat /etc/quagga/zebra.conf

password zebra
!
access-list vty permit 127.0.0.0/8
access-list vty deny any
!
line vty
 access-class vty
root@52XXZ:~#

要指定倒我們準備的 configuration 的話

root@52XXZ:~# cat /etc/icos/quagga_zebra.conf

hostname Router
password zebra

使用 zebra -d -u root -f /etc/icos/quagga_zebra.conf

root@52XXZ:~# zebra -d -u root -f /etc/icos/quagga_zebra.conf
root@52XXZ:~# ps aux | grep zebra
root     12988  0.0  0.5   2016   720 ?        Ss   22:13   0:00 zebra -d -u root -f /etc/icos/quagga_zebra.conf
root     13184  0.0  0.2   1812   364 ?        S    22:13   0:00 grep zebra

將這些行為放在 code 裡面的話 zebra 就起不來了

1420

先切回 M360P 做事

pull latest with branch relase/v0.08

build image... ok

先按照 ariel 的 proposal 先把 serving cell 頁面獨立出來

image

上 code

commit f661bde054b3e259bb8cce39ca58ffeda1a2bd20
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Tue Oct 2 15:11:30 2018 +0800

    add 'LTE / Serving Cell':
    - it is a nav tab in 'LTE / Engineer' originally

 proscend/prosrc/www/app/feature/serving_cell.html | 72 +++++++++++++++++++++++
 proscend/prosrc/www/app/feature/serving_cell.js   | 35 +++++++++++
 proscend/prosrc/www/app/locale-en.json            | 18 ++++++
 proscend/prosrc/www/app/locale-fr.json            | 18 ++++++
 proscend/prosrc/www/app/locale-zh-tw.json         | 18 ++++++
 proscend/prosrc/www/src/index.html.src            |  1 +
 proscend/prosrc/www/src/menu.html.src             |  1 +
 7 files changed, 163 insertions(+)

1510

再來開始重整 engineer 頁面

先新增一組 CGI - lte.cgi?act=multi_neighbor_pci

相對應的修改 - proscend/prosrc/webcgi/lte.c 如下

@@ -629,6 +629,53 @@ static void _lock_pci_conf_apply()



+NEIGHBOUR_LIST Neighbour_list;
+
+static json_object * _get_multi_neighbor_pci_neighbor()
+{
+    json_object *obj = json_object_new_array();
+    for (int i = 0; i < Neighbour_list.num; i ++)
+    {
+        json_object *e = json_object_new_object();
+        json_object_object_add(e, "rate", json_object_new_string(Neighbour_list.neighbor[i].rate));
+        json_object_object_add(e, "earfcn", json_object_new_int(Neighbour_list.neighbor[i].earfcn));
+        json_object_object_add(e, "pcid", json_object_new_int(Neighbour_list.neighbor[i].pcid));
+        json_object_object_add(e, "rsrq", json_object_new_int(Neighbour_list.neighbor[i].rsrq));
+        json_object_object_add(e, "rsrp", json_object_new_int(Neighbour_list.neighbor[i].rsrp));
+        json_object_object_add(e, "rssi", json_object_new_int(Neighbour_list.neighbor[i].rssi));
+        json_object_object_add(e, "sinr", json_object_new_int(Neighbour_list.neighbor[i].sinr));
+        json_object_object_add(e, "cell_resel_priority", json_object_new_int(Neighbour_list.neighbor[i].cell_resel_priority));
+        json_object_object_add(e, "select", json_object_new_boolean(Neighbour_list.neighbor[i].select));
+        json_object_array_add(obj, e);
+    }
+
+    return obj;
+}
+
+static json_object * _get_multi_neighbor_pci()
+{
+    int res;
+    res = ICOS_GetSetting(MODULE_LTE, MULTI_NEIGHBOR_PCI, 0, &Neighbour_list, sizeof(Neighbour_list));
+    if (res != ICOS_SUCCESS)
+    {
+        jweb.http.status(500);
+        jweb.out.json.fail("ICOS_GetSetting fail");
+    }
+
+    json_object *o = json_object_new_object();
+    json_object_object_add(o, "num", json_object_new_int(Neighbour_list.num));
+    json_object_object_add(o, "neighbor", _get_multi_neighbor_pci_neighbor());
+    return o;
+}
+
+static void _multi_neighbor_pci()
+{
+    json_object *multi_neighbor_pci= _get_multi_neighbor_pci();
+    jweb.out.json.data("multi_neighbor_pci", multi_neighbor_pci);
+}
+
+
+
 static void _help()
 {
     jweb.out.json.ok();
@@ -708,6 +755,10 @@ int main(void)
     {
         _lock_pci_conf_apply();
     }
+    else if (STRCMP(jweb.in.act, "multi_neighbor_pci"))
+    {
+        _multi_neighbor_pci();
+    }
     else if (STRCMP(jweb.in.act, "help"))
     {
         _help();

成果

image

1655

目前完成的第一個分頁

image

commit 先

但不要 push

commit d0cd520d7b36361e2bb9d9ec7c748c9fd6e900b6
Refs: [release/v0.08]
Author: jeffrey <[email protected]>
Date:   Tue Oct 2 17:40:40 2018 +0800

    redisign 'LTE / Engineer' web page:
    - new nav tabs
      - Neighbors
      - Locked PCIs
      - Saved Locked PCIs
    - display vm.multi_neighbor_pci.neighbor as table at nav tab 'Neighbors'

 proscend/prosrc/webcgi/lte.c                     | 51 +++++++++++++
 proscend/prosrc/www/app/feature/engineer.html    | 95 +++++++++++-------------
 proscend/prosrc/www/app/feature/engineer.js      | 42 +++++------
 proscend/prosrc/www/app/locale-en.json           | 19 ++++-
 proscend/prosrc/www/app/locale-fr.json           |  5 ++
 proscend/prosrc/www/app/locale-zh-tw.json        |  5 ++
 proscend/prosrc/www/app/services/icos.service.js |  3 +
 7 files changed, 143 insertions(+), 77 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️