Merge ~alexsander-souza/maas:lp1979403_to_3_3 into maas:3.3
- Git
- lp:~alexsander-souza/maas
- lp1979403_to_3_3
- Merge into 3.3
Proposed by
Alexsander de Souza
Status: | Merged |
---|---|
Approved by: | Alexsander de Souza |
Approved revision: | 1cc42682aa433cfd3e83a61b070c80a97bb02ae7 |
Merge reported by: | MAAS Lander |
Merged at revision: | not available |
Proposed branch: | ~alexsander-souza/maas:lp1979403_to_3_3 |
Merge into: | maas:3.3 |
Diff against target: |
365 lines (+122/-94) 3 files modified
creds.yaml (+0/-0) src/metadataserver/builtin_scripts/commissioning_scripts/bmc_config.py (+55/-40) src/metadataserver/builtin_scripts/commissioning_scripts/tests/test_bmc_config.py (+67/-54) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexsander de Souza | Approve | ||
MAAS Lander | Approve | ||
Review via email:
|
Commit message
Adding Lan_Conf_Channel_1 to 3
BMC with multiple channel can't find ip
so added Lan_Conf_Channel_1 to 3 to support them
(cherry picked from commit 9597b3b7457ccf2
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexsander de Souza (alexsander-souza) wrote : | # |
jenkins: !test
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MAAS Lander (maas-lander) wrote : | # |
UNIT TESTS
-b lp1979403_to_3_3 lp:~alexsander-souza/maas/+git/maas into -b 3.3 lp:~maas-committers/maas
STATUS: SUCCESS
COMMIT: 1cc42682aa433cf
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexsander de Souza (alexsander-souza) wrote : | # |
self-approving backport
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/creds.yaml b/creds.yaml | |||
2 | 0 | new file mode 100644 | 0 | new file mode 100644 |
3 | index 0000000..e69de29 | |||
4 | --- /dev/null | |||
5 | +++ b/creds.yaml | |||
6 | diff --git a/src/metadataserver/builtin_scripts/commissioning_scripts/bmc_config.py b/src/metadataserver/builtin_scripts/commissioning_scripts/bmc_config.py | |||
7 | index 4964f08..02e900d 100755 | |||
8 | --- a/src/metadataserver/builtin_scripts/commissioning_scripts/bmc_config.py | |||
9 | +++ b/src/metadataserver/builtin_scripts/commissioning_scripts/bmc_config.py | |||
10 | @@ -226,7 +226,7 @@ class IPMIBase(BMCConfig): | |||
11 | 226 | def _bmc_get_config(self, section=None): | 226 | def _bmc_get_config(self, section=None): |
12 | 227 | """Fetch and cache all BMC settings.""" | 227 | """Fetch and cache all BMC settings.""" |
13 | 228 | print("INFO: Reading current IPMI BMC values...") | 228 | print("INFO: Reading current IPMI BMC values...") |
15 | 229 | cmd = ["bmc-config", "--checkout"] | 229 | cmd = ["bmc-config", "--checkout", "--verbose"] |
16 | 230 | if section: | 230 | if section: |
17 | 231 | cmd += ["-S", section] | 231 | cmd += ["-S", section] |
18 | 232 | try: | 232 | try: |
19 | @@ -392,41 +392,53 @@ class IPMIBase(BMCConfig): | |||
20 | 392 | def _config_ipmi_lan_channel_settings(self): | 392 | def _config_ipmi_lan_channel_settings(self): |
21 | 393 | """Enable IPMI-over-Lan (Lan_Channel) if it is disabled""" | 393 | """Enable IPMI-over-Lan (Lan_Channel) if it is disabled""" |
22 | 394 | print("INFO: Configuring IPMI Lan_Channel...") | 394 | print("INFO: Configuring IPMI Lan_Channel...") |
23 | 395 | lan_channel = self._bmc_config.get("Lan_Channel", {}) | ||
24 | 396 | 395 | ||
28 | 397 | for key in [ | 396 | for channel in [ |
29 | 398 | "Volatile_Access_Mode", | 397 | "Lan_Channel", |
30 | 399 | "Non_Volatile_Access_Mode", | 398 | "Lan_Channel_Channel_1", |
31 | 399 | "Lan_Channel_Channel_2", | ||
32 | 400 | "Lan_Channel_Channel_3", | ||
33 | 400 | ]: | 401 | ]: |
45 | 401 | if lan_channel.get(key) != "Always_Available": | 402 | lan_channel = self._bmc_config.get(channel, {}) |
46 | 402 | print( | 403 | |
47 | 403 | "INFO: Enabling BMC network access - Lan_Channel:%s" % key | 404 | if not lan_channel: |
48 | 404 | ) | 405 | continue |
49 | 405 | # Some BMC's don't support setting Lan_Channel (see LP: #1287274). | 406 | |
50 | 406 | # If that happens, it would cause the script to fail preventing | 407 | for key in [ |
51 | 407 | # the script from continuing. To address this, simply catch the | 408 | "Volatile_Access_Mode", |
52 | 408 | # error, return and allow the script to continue. | 409 | "Non_Volatile_Access_Mode", |
53 | 409 | try: | 410 | ]: |
54 | 410 | self._bmc_set("Lan_Channel", key, "Always_Available") | 411 | if lan_channel.get(key) != "Always_Available": |
44 | 411 | except Exception: | ||
55 | 412 | print( | 412 | print( |
58 | 413 | "WARNING: Unable to set Lan_Channel:%s. " | 413 | "INFO: Enabling BMC network access - %s:%s" |
59 | 414 | "BMC may be unavailable over the network!" % key | 414 | % (channel, key) |
60 | 415 | ) | 415 | ) |
75 | 416 | 416 | # Some BMC's don't support setting Lan_Channel (see LP: #1287274). | |
76 | 417 | self._bmc_set_keys( | 417 | # If that happens, it would cause the script to fail preventing |
77 | 418 | "Lan_Channel", | 418 | # the script from continuing. To address this, simply catch the |
78 | 419 | [ | 419 | # error, return and allow the script to continue. |
79 | 420 | f"{auth_type}_{volatility}" | 420 | try: |
80 | 421 | for auth_type in [ | 421 | self._bmc_set(channel, key, "Always_Available") |
81 | 422 | "Enable_User_Level_Auth", | 422 | except Exception: |
82 | 423 | "Enable_Per_Message_Auth", | 423 | print( |
83 | 424 | "Enable_Pef_Alerting", | 424 | "WARNING: Unable to set %s:%s. " |
84 | 425 | ] | 425 | "BMC may be unavailable over the network!" |
85 | 426 | for volatility in ["Volatile", "Non_Volatile"] | 426 | % (channel, key) |
86 | 427 | ], | 427 | ) |
87 | 428 | "Yes", | 428 | |
88 | 429 | ) | 429 | self._bmc_set_keys( |
89 | 430 | channel, | ||
90 | 431 | [ | ||
91 | 432 | f"{auth_type}_{volatility}" | ||
92 | 433 | for auth_type in [ | ||
93 | 434 | "Enable_User_Level_Auth", | ||
94 | 435 | "Enable_Per_Message_Auth", | ||
95 | 436 | "Enable_Pef_Alerting", | ||
96 | 437 | ] | ||
97 | 438 | for volatility in ["Volatile", "Non_Volatile"] | ||
98 | 439 | ], | ||
99 | 440 | "Yes", | ||
100 | 441 | ) | ||
101 | 430 | 442 | ||
102 | 431 | def _config_lan_conf_auth(self): | 443 | def _config_lan_conf_auth(self): |
103 | 432 | """Configure Lan_Conf_Auth.""" | 444 | """Configure Lan_Conf_Auth.""" |
104 | @@ -577,6 +589,9 @@ class IPMI(IPMIBase): | |||
105 | 577 | mac_address = None | 589 | mac_address = None |
106 | 578 | for section_name, key in [ | 590 | for section_name, key in [ |
107 | 579 | ("Lan_Conf", "IP_Address"), | 591 | ("Lan_Conf", "IP_Address"), |
108 | 592 | ("Lan_Conf_Channel_1", "IP_Address"), | ||
109 | 593 | ("Lan_Conf_Channel_2", "IP_Address"), | ||
110 | 594 | ("Lan_Conf_Channel_3", "IP_Address"), | ||
111 | 580 | ("Lan6_Conf", "IPv6_Static_Addresses"), | 595 | ("Lan6_Conf", "IPv6_Static_Addresses"), |
112 | 581 | ("Lan6_Conf", "IPv6_Dynamic_Addresses"), | 596 | ("Lan6_Conf", "IPv6_Dynamic_Addresses"), |
113 | 582 | ]: | 597 | ]: |
114 | @@ -599,28 +614,28 @@ class IPMI(IPMIBase): | |||
115 | 599 | time.sleep(2) | 614 | time.sleep(2) |
116 | 600 | continue | 615 | continue |
117 | 601 | if section_name.startswith("Lan6_"): | 616 | if section_name.startswith("Lan6_"): |
120 | 602 | return "[%s]" % ip, mac_address | 617 | return section_name, "[%s]" % ip, mac_address |
121 | 603 | return ip, mac_address | 618 | return section_name, ip, mac_address |
122 | 604 | # No valid IP address was found. | 619 | # No valid IP address was found. |
124 | 605 | return None, mac_address | 620 | return None, None, mac_address |
125 | 606 | 621 | ||
126 | 607 | def get_bmc_ip(self): | 622 | def get_bmc_ip(self): |
127 | 608 | """Configure and retreive IPMI BMC IP.""" | 623 | """Configure and retreive IPMI BMC IP.""" |
129 | 609 | ip_address, mac_address = self._get_bmc_ip() | 624 | section_name, ip_address, mac_address = self._get_bmc_ip() |
130 | 610 | if ip_address: | 625 | if ip_address: |
131 | 611 | return ip_address, mac_address | 626 | return ip_address, mac_address |
132 | 612 | print("INFO: Attempting to enable preconfigured static IP on BMC...") | 627 | print("INFO: Attempting to enable preconfigured static IP on BMC...") |
134 | 613 | self._bmc_set("Lan_Conf", "IP_Address_Source", "Static") | 628 | self._bmc_set(section_name, "IP_Address_Source", "Static") |
135 | 614 | for _ in range(6): | 629 | for _ in range(6): |
136 | 615 | time.sleep(10) | 630 | time.sleep(10) |
138 | 616 | ip_address, mac_address = self._get_bmc_ip(True) | 631 | _, ip_address, mac_address = self._get_bmc_ip(True) |
139 | 617 | if ip_address: | 632 | if ip_address: |
140 | 618 | return ip_address, mac_address | 633 | return ip_address, mac_address |
141 | 619 | print("INFO: Attempting to enable DHCP on BMC...") | 634 | print("INFO: Attempting to enable DHCP on BMC...") |
143 | 620 | self._bmc_set("Lan_Conf", "IP_Address_Source", "Use_DHCP") | 635 | self._bmc_set(section_name, "IP_Address_Source", "Use_DHCP") |
144 | 621 | for _ in range(6): | 636 | for _ in range(6): |
145 | 622 | time.sleep(10) | 637 | time.sleep(10) |
147 | 623 | ip_address, mac_address = self._get_bmc_ip(True) | 638 | _, ip_address, mac_address = self._get_bmc_ip(True) |
148 | 624 | if ip_address: | 639 | if ip_address: |
149 | 625 | print("WARNING: BMC is configured to use DHCP!") | 640 | print("WARNING: BMC is configured to use DHCP!") |
150 | 626 | return ip_address, mac_address | 641 | return ip_address, mac_address |
151 | diff --git a/src/metadataserver/builtin_scripts/commissioning_scripts/tests/test_bmc_config.py b/src/metadataserver/builtin_scripts/commissioning_scripts/tests/test_bmc_config.py | |||
152 | index 1fced30..ea4b710 100644 | |||
153 | --- a/src/metadataserver/builtin_scripts/commissioning_scripts/tests/test_bmc_config.py | |||
154 | +++ b/src/metadataserver/builtin_scripts/commissioning_scripts/tests/test_bmc_config.py | |||
155 | @@ -490,20 +490,25 @@ EndSection | |||
156 | 490 | self.assertRaises(SystemExit, self.ipmi.add_bmc_user) | 490 | self.assertRaises(SystemExit, self.ipmi.add_bmc_user) |
157 | 491 | 491 | ||
158 | 492 | def test_set_ipmi_lan_channel_setting_verifies(self): | 492 | def test_set_ipmi_lan_channel_setting_verifies(self): |
163 | 493 | self.ipmi._bmc_config = { | 493 | |
164 | 494 | "Lan_Channel": { | 494 | for channel in [ |
165 | 495 | "Volatile_Access_Mode": "Always_Available", | 495 | "Lan_Channel", |
166 | 496 | "Non_Volatile_Access_Mode": "Always_Available", | 496 | "Lan_Channel_Channel_1", |
167 | 497 | "Lan_Channel_Channel_2", | ||
168 | 498 | "Lan_Channel_Channel_3", | ||
169 | 499 | ]: | ||
170 | 500 | self.ipmi._bmc_config = { | ||
171 | 501 | channel: { | ||
172 | 502 | "Volatile_Access_Mode": "Always_Available", | ||
173 | 503 | "Non_Volatile_Access_Mode": "Always_Available", | ||
174 | 504 | }, | ||
175 | 497 | } | 505 | } |
185 | 498 | } | 506 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
186 | 499 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 507 | mock_bmc_set_keys = self.patch(self.ipmi, "_bmc_set_keys") |
187 | 500 | mock_bmc_set_keys = self.patch(self.ipmi, "_bmc_set_keys") | 508 | self.ipmi._config_ipmi_lan_channel_settings() |
188 | 501 | self.ipmi._config_ipmi_lan_channel_settings() | 509 | self.assertFalse(mock_bmc_set.called) |
189 | 502 | self.assertThat(mock_bmc_set, MockNotCalled()) | 510 | mock_bmc_set_keys.assert_called_once_with( |
190 | 503 | self.assertThat( | 511 | channel, |
182 | 504 | mock_bmc_set_keys, | ||
183 | 505 | MockCalledOnceWith( | ||
184 | 506 | "Lan_Channel", | ||
191 | 507 | [ | 512 | [ |
192 | 508 | f"{auth_type}_{volatility}" | 513 | f"{auth_type}_{volatility}" |
193 | 509 | for auth_type in [ | 514 | for auth_type in [ |
194 | @@ -514,36 +519,36 @@ EndSection | |||
195 | 514 | for volatility in ["Volatile", "Non_Volatile"] | 519 | for volatility in ["Volatile", "Non_Volatile"] |
196 | 515 | ], | 520 | ], |
197 | 516 | "Yes", | 521 | "Yes", |
200 | 517 | ), | 522 | ) |
199 | 518 | ) | ||
201 | 519 | 523 | ||
202 | 520 | def test_set_ipmi_lan_channel_setting_enables(self): | 524 | def test_set_ipmi_lan_channel_setting_enables(self): |
207 | 521 | self.ipmi._bmc_config = { | 525 | for channel in [ |
208 | 522 | "Lan_Channel": { | 526 | "Lan_Channel", |
209 | 523 | "Volatile_Access_Mode": "Disabled", | 527 | "Lan_Channel_Channel_1", |
210 | 524 | "Non_Volatile_Access_Mode": "Pre_Boot_only", | 528 | "Lan_Channel_Channel_2", |
211 | 529 | "Lan_Channel_Channel_3", | ||
212 | 530 | ]: | ||
213 | 531 | self.ipmi._bmc_config = { | ||
214 | 532 | channel: { | ||
215 | 533 | "Volatile_Access_Mode": "Disabled", | ||
216 | 534 | "Non_Volatile_Access_Mode": "Pre_Boot_only", | ||
217 | 535 | }, | ||
218 | 525 | } | 536 | } |
240 | 526 | } | 537 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
241 | 527 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 538 | mock_bmc_set_keys = self.patch(self.ipmi, "_bmc_set_keys") |
242 | 528 | mock_bmc_set_keys = self.patch(self.ipmi, "_bmc_set_keys") | 539 | self.ipmi._config_ipmi_lan_channel_settings() |
243 | 529 | self.ipmi._config_ipmi_lan_channel_settings() | 540 | mock_bmc_set.assert_has_calls( |
244 | 530 | self.assertThat( | 541 | ( |
245 | 531 | mock_bmc_set, | 542 | call(channel, "Volatile_Access_Mode", "Always_Available"), |
246 | 532 | MockCallsMatch( | 543 | call( |
247 | 533 | call( | 544 | channel, |
248 | 534 | "Lan_Channel", "Volatile_Access_Mode", "Always_Available" | 545 | "Non_Volatile_Access_Mode", |
249 | 535 | ), | 546 | "Always_Available", |
250 | 536 | call( | 547 | ), |
251 | 537 | "Lan_Channel", | 548 | ) |
252 | 538 | "Non_Volatile_Access_Mode", | 549 | ) |
253 | 539 | "Always_Available", | 550 | mock_bmc_set_keys.assert_called_once_with( |
254 | 540 | ), | 551 | channel, |
234 | 541 | ), | ||
235 | 542 | ) | ||
236 | 543 | self.assertThat( | ||
237 | 544 | mock_bmc_set_keys, | ||
238 | 545 | MockCalledOnceWith( | ||
239 | 546 | "Lan_Channel", | ||
255 | 547 | [ | 552 | [ |
256 | 548 | f"{auth_type}_{volatility}" | 553 | f"{auth_type}_{volatility}" |
257 | 549 | for auth_type in [ | 554 | for auth_type in [ |
258 | @@ -554,8 +559,7 @@ EndSection | |||
259 | 554 | for volatility in ["Volatile", "Non_Volatile"] | 559 | for volatility in ["Volatile", "Non_Volatile"] |
260 | 555 | ], | 560 | ], |
261 | 556 | "Yes", | 561 | "Yes", |
264 | 557 | ), | 562 | ) |
263 | 558 | ) | ||
265 | 559 | 563 | ||
266 | 560 | def test_config_lan_conf_auth(self): | 564 | def test_config_lan_conf_auth(self): |
267 | 561 | self.ipmi._bmc_config = {"Lan_Channel_Auth": {}} | 565 | self.ipmi._bmc_config = {"Lan_Channel_Auth": {}} |
268 | @@ -718,7 +722,9 @@ EndSection | |||
269 | 718 | "MAC_Address": mac_address, | 722 | "MAC_Address": mac_address, |
270 | 719 | } | 723 | } |
271 | 720 | } | 724 | } |
273 | 721 | self.assertEqual((ip, mac_address), self.ipmi._get_bmc_ip()) | 725 | self.assertEqual( |
274 | 726 | ("Lan_Conf", ip, mac_address), self.ipmi._get_bmc_ip() | ||
275 | 727 | ) | ||
276 | 722 | 728 | ||
277 | 723 | def test_get_bmc_ipv6_static(self): | 729 | def test_get_bmc_ipv6_static(self): |
278 | 724 | ip = factory.make_ipv6_address() | 730 | ip = factory.make_ipv6_address() |
279 | @@ -729,7 +735,9 @@ EndSection | |||
280 | 729 | "MAC_Address": mac_address, | 735 | "MAC_Address": mac_address, |
281 | 730 | } | 736 | } |
282 | 731 | } | 737 | } |
284 | 732 | self.assertEqual((f"[{ip}]", mac_address), self.ipmi._get_bmc_ip()) | 738 | self.assertEqual( |
285 | 739 | ("Lan6_Conf", f"[{ip}]", mac_address), self.ipmi._get_bmc_ip() | ||
286 | 740 | ) | ||
287 | 733 | 741 | ||
288 | 734 | def test_get_bmc_ipv6_dynamic(self): | 742 | def test_get_bmc_ipv6_dynamic(self): |
289 | 735 | ip = factory.make_ipv6_address() | 743 | ip = factory.make_ipv6_address() |
290 | @@ -740,7 +748,9 @@ EndSection | |||
291 | 740 | "MAC_Address": mac_address, | 748 | "MAC_Address": mac_address, |
292 | 741 | } | 749 | } |
293 | 742 | } | 750 | } |
295 | 743 | self.assertEqual((f"[{ip}]", mac_address), self.ipmi._get_bmc_ip()) | 751 | self.assertEqual( |
296 | 752 | ("Lan6_Conf", f"[{ip}]", mac_address), self.ipmi._get_bmc_ip() | ||
297 | 753 | ) | ||
298 | 744 | 754 | ||
299 | 745 | def test_get_bmc_ipv6_gets_mac_From_ipv4(self): | 755 | def test_get_bmc_ipv6_gets_mac_From_ipv4(self): |
300 | 746 | ip = factory.make_ipv6_address() | 756 | ip = factory.make_ipv6_address() |
301 | @@ -749,18 +759,20 @@ EndSection | |||
302 | 749 | "Lan_Conf": {"MAC_Address": mac_address}, | 759 | "Lan_Conf": {"MAC_Address": mac_address}, |
303 | 750 | "Lan6_Conf": {"IPv6_Dynamic_Addresses": ip}, | 760 | "Lan6_Conf": {"IPv6_Dynamic_Addresses": ip}, |
304 | 751 | } | 761 | } |
306 | 752 | self.assertEqual((f"[{ip}]", mac_address), self.ipmi._get_bmc_ip()) | 762 | self.assertEqual( |
307 | 763 | ("Lan6_Conf", f"[{ip}]", mac_address), self.ipmi._get_bmc_ip() | ||
308 | 764 | ) | ||
309 | 753 | 765 | ||
310 | 754 | def test_get_bmc_ip_finds_none(self): | 766 | def test_get_bmc_ip_finds_none(self): |
311 | 755 | self.patch(self.ipmi, "_bmc_get").return_value = "" | 767 | self.patch(self.ipmi, "_bmc_get").return_value = "" |
313 | 756 | self.assertEqual((None, None), self.ipmi._get_bmc_ip()) | 768 | self.assertEqual((None, None, None), self.ipmi._get_bmc_ip()) |
314 | 757 | 769 | ||
315 | 758 | def test_get_bmc_ip(self): | 770 | def test_get_bmc_ip(self): |
316 | 759 | ip = factory.make_ip_address() | 771 | ip = factory.make_ip_address() |
317 | 760 | mac_address = factory.make_mac_address() | 772 | mac_address = factory.make_mac_address() |
318 | 761 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 773 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
319 | 762 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") | 774 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") |
321 | 763 | mock_get_bmc_ip.return_value = ip, mac_address | 775 | mock_get_bmc_ip.return_value = None, ip, mac_address |
322 | 764 | 776 | ||
323 | 765 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) | 777 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) |
324 | 766 | self.assertThat(mock_bmc_set, MockNotCalled()) | 778 | self.assertThat(mock_bmc_set, MockNotCalled()) |
325 | @@ -772,9 +784,9 @@ EndSection | |||
326 | 772 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 784 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
327 | 773 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") | 785 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") |
328 | 774 | mock_get_bmc_ip.side_effect = ( | 786 | mock_get_bmc_ip.side_effect = ( |
332 | 775 | (None, mac_address), | 787 | ("Lan_Conf", None, mac_address), |
333 | 776 | (None, mac_address), | 788 | ("Lan_Conf", None, mac_address), |
334 | 777 | (ip, mac_address), | 789 | ("Lan_Conf", ip, mac_address), |
335 | 778 | ) | 790 | ) |
336 | 779 | 791 | ||
337 | 780 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) | 792 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) |
338 | @@ -792,8 +804,8 @@ EndSection | |||
339 | 792 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 804 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
340 | 793 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") | 805 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") |
341 | 794 | mock_get_bmc_ip.side_effect = ( | 806 | mock_get_bmc_ip.side_effect = ( |
344 | 795 | *[(None, mac_address) for _ in range(8)], | 807 | *[("Lan_Conf", None, mac_address) for _ in range(8)], |
345 | 796 | (ip, mac_address), | 808 | ("Lan_Conf", ip, mac_address), |
346 | 797 | ) | 809 | ) |
347 | 798 | 810 | ||
348 | 799 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) | 811 | self.assertEqual((ip, mac_address), self.ipmi.get_bmc_ip()) |
349 | @@ -804,6 +816,7 @@ EndSection | |||
350 | 804 | call("Lan_Conf", "IP_Address_Source", "Use_DHCP"), | 816 | call("Lan_Conf", "IP_Address_Source", "Use_DHCP"), |
351 | 805 | ), | 817 | ), |
352 | 806 | ) | 818 | ) |
353 | 819 | |||
354 | 807 | self.assertThat( | 820 | self.assertThat( |
355 | 808 | mock_get_bmc_ip, | 821 | mock_get_bmc_ip, |
356 | 809 | MockCallsMatch(call(), *[call(True) for _ in range(8)]), | 822 | MockCallsMatch(call(), *[call(True) for _ in range(8)]), |
357 | @@ -812,7 +825,7 @@ EndSection | |||
358 | 812 | def test_get_bmc_ip_fails(self): | 825 | def test_get_bmc_ip_fails(self): |
359 | 813 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") | 826 | mock_bmc_set = self.patch(self.ipmi, "_bmc_set") |
360 | 814 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") | 827 | mock_get_bmc_ip = self.patch(self.ipmi, "_get_bmc_ip") |
362 | 815 | mock_get_bmc_ip.return_value = (None, None) | 828 | mock_get_bmc_ip.return_value = ("Lan_Conf", None, None) |
363 | 816 | 829 | ||
364 | 817 | self.assertRaises(SystemExit, self.ipmi.get_bmc_ip) | 830 | self.assertRaises(SystemExit, self.ipmi.get_bmc_ip) |
365 | 818 | self.assertThat( | 831 | self.assertThat( |
UNIT TESTS
-b lp1979403_to_3_3 lp:~alexsander-souza/maas/+git/maas into -b 3.3 lp:~maas-committers/maas
STATUS: FAILED maas-ci. internal: 8080/job/ maas-tester/ 2456/console d3e83a61b070c80 a97bb02ae7
LOG: http://
COMMIT: 1cc42682aa433cf