Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -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 | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 20 | "context" |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 21 | "github.com/opencord/bbsim/internal/bbsim/types" |
Matteo Scandolo | 76c3ff6 | 2020-09-24 18:03:01 -0700 | [diff] [blame] | 22 | "github.com/opencord/bbsim/internal/common" |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame^] | 23 | "github.com/opencord/voltha-protos/v5/go/openolt" |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 24 | "github.com/stretchr/testify/assert" |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 25 | "net" |
| 26 | "testing" |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 27 | "time" |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 28 | ) |
| 29 | |
| 30 | type mockService struct { |
| 31 | Name string |
| 32 | HandleAuthCallCount int |
| 33 | HandleDhcpCallCount int |
| 34 | HandlePacketsCallCount int |
| 35 | } |
| 36 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 37 | func (s *mockService) HandleAuth() { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 38 | s.HandleAuthCallCount = s.HandleAuthCallCount + 1 |
| 39 | } |
| 40 | |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 41 | func (s *mockService) HandleDhcp(pbit uint8, cTag int) { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 42 | s.HandleDhcpCallCount = s.HandleDhcpCallCount + 1 |
| 43 | } |
| 44 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 45 | func (s *mockService) HandlePackets() { |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 46 | s.HandlePacketsCallCount = s.HandlePacketsCallCount + 1 |
| 47 | } |
| 48 | |
Matteo Scandolo | 9ddb3a9 | 2021-04-14 16:16:20 -0700 | [diff] [blame] | 49 | func (s *mockService) Initialize(stream types.Stream) {} |
| 50 | func (s *mockService) UpdateStream(stream types.Stream) {} |
| 51 | func (s *mockService) Disable() {} |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 52 | |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 53 | func createTestService(needsEapol bool, needsDchp bool) (*Service, error) { |
| 54 | |
| 55 | enableContext := context.TODO() |
| 56 | |
Matteo Scandolo | 8a57481 | 2021-05-20 15:18:53 -0700 | [diff] [blame] | 57 | mac := net.HardwareAddr{0x2e, byte(1), byte(1), byte(1), byte(1), byte(1)} |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 58 | onu := createMockOnu(1, 1) |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 59 | onu.PonPort = &PonPort{} |
| 60 | onu.PonPort.Olt = &OltDevice{} |
| 61 | onu.PonPort.Olt.enableContext = enableContext |
Matteo Scandolo | 8a57481 | 2021-05-20 15:18:53 -0700 | [diff] [blame] | 62 | |
| 63 | uni := UniPort{ID: 1, Onu: onu} |
| 64 | return NewService(0, "testService", mac, &uni, 900, 900, |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 65 | needsEapol, needsDchp, false, 64, 0, false, |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 66 | 7, 7, 7, 7) |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | // test the internalState transitions |
| 70 | func TestService_InternalState(t *testing.T) { |
| 71 | s, err := createTestService(false, false) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 72 | |
| 73 | assert.Nil(t, err) |
| 74 | |
| 75 | assert.Empty(t, s.PacketCh) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 76 | s.Initialize(&mockStream{}) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 77 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 78 | // check that channels have been created |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 79 | assert.NotNil(t, s.PacketCh) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 80 | assert.NotNil(t, s.Channel) |
| 81 | |
| 82 | // set EAPOL and DHCP states to something else |
| 83 | s.EapolState.SetState("eap_response_success_received") |
| 84 | s.DHCPState.SetState("dhcp_ack_received") |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 85 | |
| 86 | s.Disable() |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 87 | // make sure the EAPOL and DHCP states have been reset after disable |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 88 | assert.Equal(t, "created", s.EapolState.Current()) |
| 89 | assert.Equal(t, "created", s.DHCPState.Current()) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 90 | |
| 91 | // make sure the channel have been closed |
| 92 | assert.Nil(t, s.Channel) |
| 93 | assert.Nil(t, s.PacketCh) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | // make sure that if the service does not need EAPOL we're not sending any packet |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 97 | func TestService_HandleAuth_noEapol(t *testing.T) { |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 98 | s, err := createTestService(false, false) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 99 | |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 100 | assert.Nil(t, err) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 101 | |
| 102 | stream := &mockStream{ |
| 103 | Calls: make(map[int]*openolt.Indication), |
| 104 | channel: make(chan int, 10), |
| 105 | } |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 106 | s.Initialize(stream) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 107 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 108 | s.HandleAuth() |
| 109 | time.Sleep(1 * time.Second) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 110 | |
| 111 | // if the service does not need EAPOL we don't expect any packet to be generated |
| 112 | assert.Equal(t, stream.CallCount, 0) |
| 113 | |
| 114 | // state should not change |
| 115 | assert.Equal(t, s.EapolState.Current(), "created") |
| 116 | } |
| 117 | |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 118 | // make sure that if the service does need EAPOL we're sending any packet |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 119 | func TestService_HandleAuth_withEapol(t *testing.T) { |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 120 | s, err := createTestService(true, false) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 121 | |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 122 | assert.Nil(t, err) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 123 | |
| 124 | stream := &mockStream{ |
| 125 | Calls: make(map[int]*openolt.Indication), |
| 126 | } |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 127 | s.Initialize(stream) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 128 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 129 | s.HandleAuth() |
| 130 | time.Sleep(1 * time.Second) |
Matteo Scandolo | 4a03626 | 2020-08-17 15:56:13 -0700 | [diff] [blame] | 131 | |
| 132 | // if the service does not need EAPOL we don't expect any packet to be generated |
| 133 | assert.Equal(t, stream.CallCount, 1) |
| 134 | |
| 135 | // state should not change |
| 136 | assert.Equal(t, s.EapolState.Current(), "eap_start_sent") |
| 137 | } |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 138 | |
| 139 | // make sure that if the service does not need DHCP we're not sending any packet |
| 140 | func TestService_HandleDhcp_not_needed(t *testing.T) { |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 141 | s, err := createTestService(false, false) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 142 | |
| 143 | assert.Nil(t, err) |
| 144 | |
| 145 | stream := &mockStream{ |
| 146 | Calls: make(map[int]*openolt.Indication), |
| 147 | } |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 148 | s.Initialize(stream) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 149 | |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 150 | s.HandleDhcp(7, 900) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 151 | time.Sleep(1 * time.Second) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 152 | |
| 153 | assert.Equal(t, stream.CallCount, 0) |
| 154 | |
| 155 | // state should not change |
| 156 | assert.Equal(t, s.DHCPState.Current(), "created") |
| 157 | } |
| 158 | |
| 159 | // when we receive a DHCP flow we call HandleDhcp an all the ONU Services |
| 160 | // each service device whether the tag matches it's own configuration |
| 161 | func TestService_HandleDhcp_different_c_Tag(t *testing.T) { |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 162 | s, err := createTestService(false, true) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 163 | |
| 164 | assert.Nil(t, err) |
| 165 | |
| 166 | stream := &mockStream{ |
| 167 | Calls: make(map[int]*openolt.Indication), |
| 168 | } |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 169 | s.Initialize(stream) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 170 | |
| 171 | // NOTE that the c_tag is different from the one configured in the service |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 172 | s.HandleDhcp(7, 800) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 173 | time.Sleep(1 * time.Second) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 174 | |
| 175 | assert.Equal(t, stream.CallCount, 0) |
| 176 | |
| 177 | // state should not change |
| 178 | assert.Equal(t, s.DHCPState.Current(), "created") |
| 179 | } |
| 180 | |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 181 | // when we receive a DHCP flow we call HandleDhcp an all the ONU Services |
| 182 | // each service device whether the tag matches it's own configuration |
| 183 | func TestService_HandleDhcp_different_pbit(t *testing.T) { |
| 184 | s, err := createTestService(false, true) |
| 185 | |
| 186 | assert.Nil(t, err) |
| 187 | |
| 188 | stream := &mockStream{ |
| 189 | Calls: make(map[int]*openolt.Indication), |
| 190 | } |
| 191 | s.Initialize(stream) |
| 192 | |
| 193 | // NOTE that the c_tag is different from the one configured in the service |
| 194 | s.HandleDhcp(5, 900) |
| 195 | time.Sleep(1 * time.Second) |
| 196 | |
| 197 | assert.Equal(t, stream.CallCount, 0) |
| 198 | |
| 199 | // state should not change |
| 200 | assert.Equal(t, s.DHCPState.Current(), "created") |
| 201 | } |
| 202 | |
| 203 | // if PBIT is 255 it means all of them, so start DHCP if the C_TAG matches |
| 204 | func TestService_HandleDhcp_pbit_255(t *testing.T) { |
| 205 | s, err := createTestService(false, true) |
| 206 | |
| 207 | assert.Nil(t, err) |
| 208 | |
| 209 | stream := &mockStream{ |
| 210 | Calls: make(map[int]*openolt.Indication), |
| 211 | } |
| 212 | s.Initialize(stream) |
| 213 | |
| 214 | // NOTE that the c_tag is different from the one configured in the service |
| 215 | s.HandleDhcp(255, 900) |
| 216 | time.Sleep(1 * time.Second) |
| 217 | |
| 218 | assert.Equal(t, 1, stream.CallCount) |
| 219 | assert.Equal(t, s.DHCPState.Current(), "dhcp_discovery_sent") |
| 220 | } |
| 221 | |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 222 | // make sure that if the service does need DHCP we're sending any packet |
| 223 | func TestService_HandleDhcp_needed(t *testing.T) { |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 224 | s, err := createTestService(false, true) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 225 | |
| 226 | assert.Nil(t, err) |
| 227 | |
| 228 | stream := &mockStream{ |
| 229 | Calls: make(map[int]*openolt.Indication), |
| 230 | } |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 231 | s.Initialize(stream) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 232 | |
Matteo Scandolo | bd875b3 | 2020-09-18 17:46:31 -0700 | [diff] [blame] | 233 | s.HandleDhcp(7, 900) |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 234 | time.Sleep(1 * time.Second) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 235 | |
Matteo Scandolo | adc72a8 | 2020-09-08 18:46:08 -0700 | [diff] [blame] | 236 | assert.Equal(t, 1, stream.CallCount) |
| 237 | assert.Equal(t, "dhcp_discovery_sent", s.DHCPState.Current()) |
Matteo Scandolo | 75ed5b9 | 2020-09-03 09:03:16 -0700 | [diff] [blame] | 238 | } |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 239 | |
| 240 | // Test that if the EAPOL state machine doesn't complete in 30 seconds we |
| 241 | // move it to EAPOL failed |
| 242 | func TestService_EAPOLFailed(t *testing.T) { |
Matteo Scandolo | 76c3ff6 | 2020-09-24 18:03:01 -0700 | [diff] [blame] | 243 | |
| 244 | common.Config = &common.GlobalConfig{ |
| 245 | BBSim: common.BBSimConfig{ |
| 246 | AuthRetry: false, |
| 247 | }, |
| 248 | } |
| 249 | |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 250 | // override the default wait time |
| 251 | eapolWaitTime = 500 * time.Millisecond |
| 252 | s, err := createTestService(true, false) |
| 253 | |
| 254 | assert.Nil(t, err) |
| 255 | |
| 256 | stream := &mockStream{ |
| 257 | Calls: make(map[int]*openolt.Indication), |
| 258 | } |
| 259 | s.Initialize(stream) |
| 260 | |
| 261 | // set to failed if timeout occurs |
| 262 | _ = s.EapolState.Event("start_auth") |
| 263 | time.Sleep(1 * time.Second) |
| 264 | assert.Equal(t, "auth_failed", s.EapolState.Current()) |
| 265 | |
| 266 | // do not set to failed if succeeded |
| 267 | s.EapolState.SetState("created") |
| 268 | _ = s.EapolState.Event("start_auth") |
| 269 | s.EapolState.SetState("eap_response_success_received") |
| 270 | time.Sleep(1 * time.Second) |
| 271 | assert.Equal(t, "eap_response_success_received", s.EapolState.Current()) |
| 272 | |
| 273 | } |
| 274 | |
Matteo Scandolo | 76c3ff6 | 2020-09-24 18:03:01 -0700 | [diff] [blame] | 275 | func TestService_EAPOLRestart(t *testing.T) { |
| 276 | |
| 277 | common.Config = &common.GlobalConfig{ |
| 278 | BBSim: common.BBSimConfig{ |
| 279 | AuthRetry: true, |
| 280 | }, |
| 281 | } |
| 282 | |
| 283 | eapolWaitTime = 500 * time.Millisecond |
| 284 | s, err := createTestService(true, false) |
| 285 | |
| 286 | assert.Nil(t, err) |
| 287 | |
| 288 | stream := &mockStream{ |
| 289 | Calls: make(map[int]*openolt.Indication), |
| 290 | } |
| 291 | s.Initialize(stream) |
| 292 | |
| 293 | // set to failed if timeout occurs |
| 294 | _ = s.EapolState.Event("start_auth") |
| 295 | |
| 296 | // after a second EAPOL should have failed and restarted |
| 297 | time.Sleep(1 * time.Second) |
| 298 | assert.Equal(t, "eap_start_sent", s.EapolState.Current()) |
| 299 | } |
| 300 | |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 301 | // Test that if the DHCP state machine doesn't complete in 30 seconds we |
| 302 | // move it to DHCP failed |
| 303 | func TestService_DHCPFailed(t *testing.T) { |
Matteo Scandolo | 76c3ff6 | 2020-09-24 18:03:01 -0700 | [diff] [blame] | 304 | |
| 305 | common.Config = &common.GlobalConfig{ |
| 306 | BBSim: common.BBSimConfig{ |
| 307 | DhcpRetry: false, |
| 308 | }, |
| 309 | } |
| 310 | |
Matteo Scandolo | e9f5a6b | 2020-09-16 15:54:38 -0700 | [diff] [blame] | 311 | // override the default wait time |
| 312 | dhcpWaitTime = 100 * time.Millisecond |
| 313 | s, err := createTestService(false, true) |
| 314 | |
| 315 | assert.Nil(t, err) |
| 316 | |
| 317 | stream := &mockStream{ |
| 318 | Calls: make(map[int]*openolt.Indication), |
| 319 | } |
| 320 | s.Initialize(stream) |
| 321 | |
| 322 | // set to failed if timeout occurs |
| 323 | _ = s.DHCPState.Event("start_dhcp") |
| 324 | time.Sleep(1 * time.Second) |
| 325 | assert.Equal(t, "dhcp_failed", s.DHCPState.Current()) |
| 326 | |
| 327 | // do not set to failed if succeeded |
| 328 | s.DHCPState.SetState("created") |
| 329 | _ = s.DHCPState.Event("start_dhcp") |
| 330 | s.DHCPState.SetState("dhcp_ack_received") |
| 331 | time.Sleep(1 * time.Second) |
| 332 | assert.Equal(t, "dhcp_ack_received", s.DHCPState.Current()) |
| 333 | } |
Matteo Scandolo | 76c3ff6 | 2020-09-24 18:03:01 -0700 | [diff] [blame] | 334 | |
| 335 | func TestService_DHCPRestart(t *testing.T) { |
| 336 | common.Config = &common.GlobalConfig{ |
| 337 | BBSim: common.BBSimConfig{ |
| 338 | DhcpRetry: true, |
| 339 | }, |
| 340 | } |
| 341 | |
| 342 | // override the default wait time |
| 343 | dhcpWaitTime = 100 * time.Millisecond |
| 344 | s, err := createTestService(false, true) |
| 345 | |
| 346 | assert.Nil(t, err) |
| 347 | |
| 348 | stream := &mockStream{ |
| 349 | Calls: make(map[int]*openolt.Indication), |
| 350 | } |
| 351 | s.Initialize(stream) |
| 352 | |
| 353 | // set to failed if timeout occurs |
| 354 | _ = s.DHCPState.Event("start_dhcp") |
| 355 | time.Sleep(1 * time.Second) |
| 356 | assert.Equal(t, "dhcp_discovery_sent", s.DHCPState.Current()) |
| 357 | } |