Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package devices |
| 18 | |
| 19 | import ( |
Matteo Scandolo | d15c0b4 | 2021-03-22 11:38:13 -0700 | [diff] [blame] | 20 | omcilib "github.com/opencord/bbsim/internal/common/omci" |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame^] | 21 | me "github.com/opencord/omci-lib-go/v2/generated" |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 22 | "testing" |
Zdravko Bozakov | 681364d | 2019-11-10 14:28:46 +0100 | [diff] [blame] | 23 | |
| 24 | "gotest.tools/assert" |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 25 | ) |
| 26 | |
| 27 | func Test_Onu_StateMachine_enable(t *testing.T) { |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 28 | onu := createTestOnu() |
Matteo Scandolo | 9f4bf4f | 2021-06-22 09:41:02 +0200 | [diff] [blame] | 29 | assert.Equal(t, onu.InternalState.Current(), OnuStateInitialized) |
| 30 | _ = onu.InternalState.Event(OnuTxDiscover) |
| 31 | assert.Equal(t, onu.InternalState.Current(), OnuStateDiscovered) |
| 32 | _ = onu.InternalState.Event(OnuTxEnable) |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 33 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 34 | } |
| 35 | |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 36 | func Test_Onu_StateMachine_disable(t *testing.T) { |
| 37 | onu := createTestOnu() |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 38 | onu.InternalState.SetState(OnuStateEnabled) |
| 39 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 40 | |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 41 | onu.Flows = []FlowKey{ |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 42 | {ID: 1, Direction: "upstream"}, |
| 43 | {ID: 2, Direction: "downstream"}, |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 44 | } |
Matteo Scandolo | d15c0b4 | 2021-03-22 11:38:13 -0700 | [diff] [blame] | 45 | key := omcilib.OnuAlarmInfoMapKey{ |
| 46 | MeInstance: 257, |
| 47 | MeClassID: me.PhysicalPathTerminationPointEthernetUniClassID, |
| 48 | } |
| 49 | onu.onuAlarmsInfo[key] = omcilib.OnuAlarmInfo{SequenceNo: 1, AlarmBitMap: [28]byte{}} |
| 50 | onu.PonPort.storeOnuId(onu.ID, onu.SerialNumber) |
| 51 | onu.PonPort.storeAllocId(1, onu.SerialNumber) |
| 52 | onu.PonPort.storeGemPort(1, onu.SerialNumber) |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 53 | |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 54 | _ = onu.InternalState.Event(OnuTxDisable) |
| 55 | assert.Equal(t, onu.InternalState.Current(), OnuStateDisabled) |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 56 | |
Matteo Scandolo | d15c0b4 | 2021-03-22 11:38:13 -0700 | [diff] [blame] | 57 | assert.Equal(t, len(onu.onuAlarmsInfo), 0) |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 58 | assert.Equal(t, len(onu.Flows), 0) |
Matteo Scandolo | d15c0b4 | 2021-03-22 11:38:13 -0700 | [diff] [blame] | 59 | assert.Equal(t, len(onu.PonPort.AllocatedOnuIds), 0) |
| 60 | assert.Equal(t, len(onu.PonPort.AllocatedAllocIds), 0) |
| 61 | assert.Equal(t, len(onu.PonPort.AllocatedGemPorts), 0) |
Matteo Scandolo | 47ef64b | 2020-04-20 14:16:07 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Matteo Scandolo | 9f4bf4f | 2021-06-22 09:41:02 +0200 | [diff] [blame] | 64 | func Test_Onu_StateMachine_pon_disable(t *testing.T) { |
| 65 | onu := createTestOnu() |
| 66 | var err error |
| 67 | |
| 68 | onu.InternalState.SetState(OnuStateEnabled) |
| 69 | err = onu.InternalState.Event(OnuTxPonDisable) |
| 70 | assert.NilError(t, err) |
| 71 | assert.Equal(t, OnuStatePonDisabled, onu.InternalState.Current()) |
| 72 | |
| 73 | onu.InternalState.SetState(OnuStateImageDownloadComplete) |
| 74 | err = onu.InternalState.Event(OnuTxPonDisable) |
| 75 | assert.NilError(t, err) |
| 76 | assert.Equal(t, OnuStatePonDisabled, onu.InternalState.Current()) |
| 77 | } |
| 78 | |
| 79 | func Test_Onu_StateMachine_software_image(t *testing.T) { |
| 80 | onu := createTestOnu() |
| 81 | var err error |
| 82 | |
| 83 | // happy path |
| 84 | onu.InternalState.SetState(OnuStateEnabled) |
| 85 | err = onu.InternalState.Event(OnuTxStartImageDownload) |
| 86 | assert.NilError(t, err) |
| 87 | assert.Equal(t, OnuStateImageDownloadStarted, onu.InternalState.Current()) |
| 88 | |
| 89 | err = onu.InternalState.Event(OnuTxProgressImageDownload) |
| 90 | assert.NilError(t, err) |
| 91 | assert.Equal(t, OnuStateImageDownloadInProgress, onu.InternalState.Current()) |
| 92 | |
| 93 | err = onu.InternalState.Event(OnuTxCompleteImageDownload) |
| 94 | assert.NilError(t, err) |
| 95 | assert.Equal(t, OnuStateImageDownloadComplete, onu.InternalState.Current()) |
| 96 | |
| 97 | err = onu.InternalState.Event(OnuTxActivateImage) |
| 98 | assert.NilError(t, err) |
| 99 | assert.Equal(t, OnuStateImageActivated, onu.InternalState.Current()) |
| 100 | |
| 101 | // after image activate we get an ONU reboot, thus the state is back to Enabled before committing |
| 102 | onu.InternalState.SetState(OnuStateEnabled) |
| 103 | err = onu.InternalState.Event(OnuTxCommitImage) |
| 104 | assert.NilError(t, err) |
| 105 | assert.Equal(t, OnuStateImageCommitted, onu.InternalState.Current()) |
| 106 | |
| 107 | // but we should be able to start a new download |
| 108 | err = onu.InternalState.Event(OnuTxStartImageDownload) |
| 109 | assert.NilError(t, err) |
| 110 | assert.Equal(t, OnuStateImageDownloadStarted, onu.InternalState.Current()) |
| 111 | } |
| 112 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 113 | // check that I can go to auth_started only if |
| 114 | // - the GemPort is set |
| 115 | // - the eapolFlow is received |
| 116 | func Test_Onu_StateMachine_eapol_no_flow(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 117 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 118 | onu := createTestOnu() |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 119 | |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 120 | onu.InternalState.SetState(OnuStateEnabled) |
| 121 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 122 | |
| 123 | // fail as no EapolFlow has been received |
| 124 | err := onu.InternalState.Event("start_auth") |
| 125 | if err == nil { |
| 126 | t.Fatal("can't start EAPOL without EapolFlow") |
| 127 | } |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 128 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 129 | assert.Equal(t, err.Error(), "transition canceled with error: cannot-go-to-auth-started-as-eapol-flow-is-missing") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 132 | func Test_Onu_StateMachine_eapol_no_gem(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 133 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 134 | onu := createTestOnu() |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 135 | |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 136 | onu.InternalState.SetState(OnuStateEnabled) |
| 137 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 138 | |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 139 | // fail has no GemPort has been set |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 140 | err := onu.InternalState.Event("start_auth") |
| 141 | if err == nil { |
| 142 | t.Fatal("can't start EAPOL without GemPort") |
| 143 | } |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 144 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 145 | assert.Equal(t, err.Error(), "transition canceled with error: cannot-go-to-auth-started-as-gemport-is-missing") |
| 146 | |
| 147 | } |
| 148 | |
| 149 | func Test_Onu_StateMachine_eapol_start(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 150 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 151 | onu := createTestOnu() |
| 152 | |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 153 | onu.InternalState.SetState(OnuStateEnabled) |
| 154 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 155 | |
| 156 | // succeed |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 157 | _ = onu.InternalState.Event("start_auth") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 158 | assert.Equal(t, onu.InternalState.Current(), "auth_started") |
| 159 | } |
| 160 | |
| 161 | func Test_Onu_StateMachine_eapol_states(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 162 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 163 | onu := createTestOnu() |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 164 | |
| 165 | onu.InternalState.SetState("auth_started") |
| 166 | |
| 167 | assert.Equal(t, onu.InternalState.Current(), "auth_started") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 168 | _ = onu.InternalState.Event("eap_start_sent") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 169 | assert.Equal(t, onu.InternalState.Current(), "eap_start_sent") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 170 | _ = onu.InternalState.Event("eap_response_identity_sent") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 171 | assert.Equal(t, onu.InternalState.Current(), "eap_response_identity_sent") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 172 | _ = onu.InternalState.Event("eap_response_challenge_sent") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 173 | assert.Equal(t, onu.InternalState.Current(), "eap_response_challenge_sent") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 174 | _ = onu.InternalState.Event("eap_response_success_received") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 175 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
Matteo Scandolo | 5e081b5 | 2019-11-21 14:34:25 -0800 | [diff] [blame] | 176 | |
| 177 | // test that we can retrigger EAPOL |
| 178 | states := []string{"eap_start_sent", "eap_response_identity_sent", "eap_response_challenge_sent", "eap_response_success_received", "auth_failed", "dhcp_ack_received", "dhcp_failed"} |
| 179 | for _, state := range states { |
| 180 | onu.InternalState.SetState(state) |
| 181 | err := onu.InternalState.Event("start_auth") |
| 182 | assert.Equal(t, err, nil) |
| 183 | assert.Equal(t, onu.InternalState.Current(), "auth_started") |
| 184 | } |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 185 | } |
| 186 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 187 | // if auth is set to true we can't go from enabled to dhcp_started |
| 188 | func Test_Onu_StateMachine_dhcp_no_auth(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 189 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 190 | onu := createTestOnu() |
| 191 | |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 192 | onu.InternalState.SetState(OnuStateEnabled) |
| 193 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 194 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 195 | err := onu.InternalState.Event("start_dhcp") |
| 196 | if err == nil { |
| 197 | t.Fail() |
| 198 | } |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 199 | assert.Equal(t, onu.InternalState.Current(), OnuStateEnabled) |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 200 | assert.Equal(t, err.Error(), "transition canceled with error: cannot-go-to-dhcp-started-as-authentication-is-required") |
| 201 | } |
| 202 | |
| 203 | // if the DHCP flow has not been received we can't start authentication |
| 204 | func Test_Onu_StateMachine_dhcp_no_flow(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 205 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 206 | onu := createTestOnu() |
| 207 | |
| 208 | onu.InternalState.SetState("eap_response_success_received") |
| 209 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
| 210 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 211 | err := onu.InternalState.Event("start_dhcp") |
| 212 | if err == nil { |
| 213 | t.Fail() |
| 214 | } |
| 215 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
| 216 | assert.Equal(t, err.Error(), "transition canceled with error: cannot-go-to-dhcp-started-as-dhcp-flow-is-missing") |
| 217 | } |
| 218 | |
| 219 | // if the ONU does not have a GemPort we can't start DHCP |
| 220 | func Test_Onu_StateMachine_dhcp_no_gem(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 221 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 222 | onu := createTestOnu() |
| 223 | |
| 224 | onu.InternalState.SetState("eap_response_success_received") |
| 225 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
| 226 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 227 | err := onu.InternalState.Event("start_dhcp") |
| 228 | if err == nil { |
| 229 | t.Fail() |
| 230 | } |
| 231 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
| 232 | assert.Equal(t, err.Error(), "transition canceled with error: cannot-go-to-dhcp-started-as-gemport-is-missing") |
| 233 | } |
| 234 | |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 235 | func Test_Onu_StateMachine_dhcp_start(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 236 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 237 | onu := createTestOnu() |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 238 | |
| 239 | onu.InternalState.SetState("eap_response_success_received") |
| 240 | assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received") |
| 241 | |
Matteo Scandolo | 5ff8008 | 2019-12-20 13:20:57 -0800 | [diff] [blame] | 242 | // default transition |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 243 | _ = onu.InternalState.Event("start_dhcp") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 244 | assert.Equal(t, onu.InternalState.Current(), "dhcp_started") |
| 245 | } |
| 246 | |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 247 | func Test_Onu_StateMachine_dhcp_states(t *testing.T) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 248 | t.Skip("Needs to be moved in the Service struct") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 249 | onu := createTestOnu() |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 250 | |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 251 | onu.InternalState.SetState("dhcp_started") |
| 252 | |
| 253 | assert.Equal(t, onu.InternalState.Current(), "dhcp_started") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 254 | _ = onu.InternalState.Event("dhcp_discovery_sent") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 255 | assert.Equal(t, onu.InternalState.Current(), "dhcp_discovery_sent") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 256 | _ = onu.InternalState.Event("dhcp_request_sent") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 257 | assert.Equal(t, onu.InternalState.Current(), "dhcp_request_sent") |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 258 | _ = onu.InternalState.Event("dhcp_ack_received") |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 259 | assert.Equal(t, onu.InternalState.Current(), "dhcp_ack_received") |
Matteo Scandolo | 5e081b5 | 2019-11-21 14:34:25 -0800 | [diff] [blame] | 260 | |
| 261 | // test that we can retrigger DHCP |
Matteo Scandolo | 5e081b5 | 2019-11-21 14:34:25 -0800 | [diff] [blame] | 262 | states := []string{"eap_response_success_received", "dhcp_discovery_sent", "dhcp_request_sent", "dhcp_ack_received", "dhcp_failed"} |
| 263 | for _, state := range states { |
| 264 | onu.InternalState.SetState(state) |
| 265 | err := onu.InternalState.Event("start_dhcp") |
| 266 | assert.Equal(t, err, nil) |
| 267 | assert.Equal(t, onu.InternalState.Current(), "dhcp_started") |
| 268 | } |
Matteo Scandolo | 99f1846 | 2019-10-28 14:14:28 -0700 | [diff] [blame] | 269 | } |