summaryrefslogtreecommitdiffstats
path: root/_ont/ont-luna-sdk-useful-commands.md
blob: 724add3a09b7c716ca513f0458269bb7a72e0fd6 (plain) (blame)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# Useful files and binaries

## Useful files
- `/var/config/lastgood.xml` - Contains the user portion of the configuration
{% if include.lastgoodHs %}
- `/var/config/lastgood-hs.xml` - Contains the "hardware" configuration (which _should not_ be changed)
{% endif %}
- `/tmp/omcilog` - OMCI messages logs (must be enabeled, see below)

## Useful binaries
- `{{ include.flash }}` - Used to manipulate the config files in a somewhat safe manner
- `xmlconfig` - Used for low-level manipulation of the XML config files. Called by `{{ include.flash }}`
- `nv` - Used to manipulate nvram storage, including persistent config entries via `nv setenv`/`nv getenv`
- `omcicli` - Used to interact with the running OMCI daemon
- `omci_app` - The OMCI daemon
- `diag` - Used to run low-level diagnostics commands on the stick

# GPON ONU status

## Getting the operational status of the ONU

```sh
diag gpon get onu-state
```

## Querying a particular OMCI ME
```sh
# omcicli mib get MIB_IDX
```


{% if include.speedLan %}

## Getting/Setting Speed LAN Mode
{% assign customSpeedLanAlert = include.customSpeedLanAlert | default: "Before editing the speed make sure your hardware supports it." %}
{% include alert.html content=customSpeedLanAlert alert="Note" icon="svg-info" color="blue" %}

To change the link mode use this command:

```sh
# {{ include.flash }} get LAN_SDS_MODE
LAN_SDS_MODE=0
# {{ include.flash }} set LAN_SDS_MODE 1
```

| Value | `cat /proc/kmsg`                     | Mode     | Behavior                    |
| ----- | ------------------------------------ | -------- | --------------------------- |{% if include.speedLan contains '0' %}
| 0     | `<4>change mode to 0(GE/FE PHY)`     | `TP`     | 1GbaseT/100baseT            |{% endif %}{% if include.speedLan contains '1' %}
| 1     | `<4>change mode to 1(Fiber 1G)`      | `FIBER`  | 1GbaseX with auto-neg on    |{% endif %}{% if include.speedLan contains '2' %}
| 2     | `<4>change mode to 2(SGMII PHY)`     | `TP MII` | 1Gb PHY                     |{% endif %}{% if include.speedLan contains '3' %}
| 3     | `<4>change mode to 3(SGMII MAC)`     | `MII`    | 1Gb MAC                     |{% endif %}{% if include.speedLan contains '4' %}
| 4     | `<4>change mode to 4(HiSGMII PHY)`   | `TP MII` | 2.5Gb PHY                   |{% endif %}{% if include.speedLan contains '5' %}
| 5     | `<4>change mode to 5(HiSGMII MAC)`   | `MII`    | 2.5Gb MAC                   |{% endif %}{% if include.speedLan contains '6' %}
| 6     | `<4>change mode to 6(2500BaseX)`     | `FIBER`  | 2500baseX with auto-neg on  |{% endif %}{% if include.speedLan contains '7' %}
| 7     | `<4>change mode to 7(SGMII Force)`   | `TP`     | 1GbaseT with auto-neg off   |{% endif %}{% if include.speedLan contains '8' %}
| 8     | `<4>change mode to 8(HISGMII Force)` | `TP`     | 2500baseT with auto-neg off |{% endif %}

{% endif %}

# GPON/OMCI settings

## Getting/Setting ONU GPON Serial Number
```sh
# {{ include.flash }} get GPON_SN
GPON_SN=TMBB00000000
# {{ include.flash }} set GPON_SN TMBB0A1B2C3D
```

## Getting/Setting ONU GPON PLOAM password
{% if include.ploam == 'asciiAndHex' %}

{% include alert.html content="The PLOAM password can be saved in either ASCII or HEX format, without any 0x or separators" alert="Note" icon="svg-info" color="blue" %}

```sh
# {{ include.flash }} get GPON_PLOAM_PASSWD
GPON_PLOAM_PASSWD=AAAAAAAAAA
# {{ include.flash }} set GPON_PLOAM_PASSWD AAAAAAAAAA
# {{ include.flash }} set GPON_PLOAM_PASSWD 41414141414141414141
```

{% elsif include.ploam == 'hex' %}

{% include alert.html content="The PLOAM password is stored in HEX format, without any 0x or separators" alert="Note" icon="svg-info" color="blue" %}

```sh
# {{ include.flash }} get GPON_PLOAM_PASSWD
GPON_PLOAM_PASSWD=41414141414141414141
# {{ include.flash }} set GPON_PLOAM_PASSWD 41414141414141414141
```
{% elsif include.ploam == 'ascii' %}

{% include alert.html content="The PLOAM password is stored in ASCII format" alert="Info" icon="svg-info" color="blue" %}

```sh
# {{ include.flash }} get GPON_PLOAM_PASSWD
GPON_PLOAM_PASSWD=AAAAAAAAAA
# {{ include.flash }} set GPON_PLOAM_PASSWD AAAAAAAAAA
```
{% endif %}

## Getting/Setting OMCI software version (ME 7)

{% if include.customSwVersionAlert %}

{% assign customSwVersionAlert = include.customSwVersionAlert %}
{% include alert.html content=customSwVersionAlert alert="Note" icon="svg-info" color="blue" %}

{% endif %}

{% if include.flashSwVersion %}
```sh
# {{ include.flash }} get OMCI_SW_VER1
OMCI_SW_VER1=YOURFIRSTSWVER
# {{ include.flash }} set OMCI_SW_VER1 YOURFIRSTSWVER
# {{ include.flash }} get OMCI_SW_VER2
OMCI_SW_VER1=YOURSECONDSWVER
# {{ include.flash }} set OMCI_SW_VER2 YOURSECONDSWVER
```
{% else %}
```sh
# nv setenv sw_custom_version0 YOURFIRSTSWVER
# nv setenv sw_custom_version1 YOURSECONDSWVER
```
{% endif %}

## Getting/Setting OMCI hardware version (ME 256)

{% if include.customHwVersionAlert %}

{% assign customHwVersionAlert = include.customHwVersionAlert %}
{% include alert.html content=customHwVersionAlert alert="Note" icon="svg-info" color="blue" %}

{% endif %}

```sh
# {{ include.flash }} get HW_HWVER
HW_HWVER=V2.0
# {{ include.flash }} set HW_HWVER MYHWVERSION
```

## Getting/Setting OMCI vendor ID (ME 256)

{% if include.customVendorAlert %}

{% assign customVendorAlert = include.customVendorAlert %}
{% include alert.html content=customVendorAlert alert="Note" icon="svg-info" color="blue" %}

{% endif %}

```sh
# {{ include.flash }} get PON_VENDOR_ID  
PON_VENDOR_ID=ZTEG
# {{ include.flash }} set PON_VENDOR_ID HWTC
```

## Getting/Setting OMCI equipment ID (ME 257)

{% if include.customEquipAlert %}

{% assign customEquipAlert = include.customEquipAlert %}
{% include alert.html content=customEquipAlert alert="Note" icon="svg-info" color="blue" %}

{% endif %}

```sh
# {{ include.flash }} get GPON_ONU_MODEL
GPON_ONU_MODEL=DFP-34X-2C2
# {{ include.flash }} set GPON_ONU_MODEL DFP-34X-XXX
```

## Getting/Setting OMCI OLT Mode and Fake OMCI

Configure how ONT Stick handle OMCI from OLT:

```sh
# {{ include.flash }} get OMCI_OLT_MODE
OMCI_OLT_MODE=1
# {{ include.flash }} set OMCI_OLT_MODE 2
```

| Value | Note            | OMCI Information                                                                                       |
| ----- | --------------- | ------------------------------------------------------------------------------------------------------ |
| 0     | Default Mode    | Stock setting, some values cannot be changed                                                           |
| 1     | Huawei OLT Mode | Huawei MA5671a                                                                                         |
| 2     | ZTE OLT Mode    | ZTE                                                                                                    |
| 3     | Customized Mode | Custom Software/Hardware Version, OMCC, etc...                                                         |{% if include.omciOLT21 %}
| 21    | Owerflow Mode   | Custom Software/Hardware Version, OMCC, etc... (this is a hack and causes sigsegv of `/bin/checkomci`) |{% endif %}

Some vendors/wholesale providers/ISPs have explicit LAN Port Number provisioning or proprietary OMCI that the stick cannot understand, this will make the stick reply OK to whatever the OLT sends it via OMCI. 

`0` = Disable, `1` = Enable, Default is 0

```sh
# {{ include.flash }} get OMCI_FAKE_OK
OMCI_FAKE_OK=0
# {{ include.flash }} set OMCI_FAKE_OK 1
```

# Advanced settings

## Setting management IP

```sh
# {{ include.flash }} get LAN_IP_ADDR
LAN_IP_ADDR=192.168.2.1
# {{ include.flash }} set LAN_IP_ADDR 192.168.1.1
```

## Getting/Setting the L2 Bridge MTU
{% include alert.html content="Settings given via diag are not permanent after reboot" alert="Note" icon="svg-info" color="blue" %}

Getting/Setting the MTU of the L2 bridge
```sh
# diag switch get max-pkt-len port all 
Port Speed 
---------- 
0 1538 
2 2031 
# diag switch set max-pkt-len port all length 2000
```

## Checking the currently active image
```sh
# nv getenv sw_active
sw_active=1
# nv getenv sw_version0
sw_version0=V1_7_8_210412
# nv getenv sw_version1
sw_version1=V1_7_8_210412
```

## Booting to a different image
```sh
# nv setenv sw_commit 0|1
# reboot
```