From 184727408a4a360efc005c845b917b90a7a2b245 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 13 Oct 2020 12:24:04 -0400 Subject: [PATCH] Have configbmc wait for settings to complete There has been some confusion when configbmc changes are deferred until later. Reduce confusion by waiting for the settings to take effect, but avoiding checking each parameter to preserve most of the speedup. --- .../el8/profiles/default/scripts/configbmc | 90 +++++++++++++++---- .../profiles/default/scripts/configbmc | 90 +++++++++++++++---- 2 files changed, 148 insertions(+), 32 deletions(-) diff --git a/confluent_osdeploy/el8/profiles/default/scripts/configbmc b/confluent_osdeploy/el8/profiles/default/scripts/configbmc index 8e4fe070..7176c12c 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/configbmc +++ b/confluent_osdeploy/el8/profiles/default/scripts/configbmc @@ -111,6 +111,14 @@ class Session(object): self.databuffer.raw[1:self.rsp.msg.data_len])} return response + def await_config(s, bmccfg, channel): + vlan = bmccfg.get('bmcvlan', None) + ipv4 = bmccfg.get('bmcipv4', None) + prefix = bmccfg.get('prefixv4', None) + gw = bmccfg.get('bmcgw', None) + + + def raw_command(self, netfn, command, @@ -217,8 +225,7 @@ def set_port_xcc(s, port, model): sys.stdout.write('Complete\n') -def set_vlan(s, vlan, channel): - ovlan = vlan +def check_vlan(s, vlan, channel): if vlan == 'off': vlan = b'\x00\x00' else: @@ -229,7 +236,19 @@ def set_vlan(s, vlan, channel): currvlan = bytes(s.raw_command(0xc, 2, bytearray([channel, 0x14 ,0, 0]))['data'][1:]) if bytearray(currvlan)[1] & 0b10000000 == 0: currvlan = b'\x00\x00' - if currvlan == vlan: + return currvlan == vlan + + +def set_vlan(s, vlan, channel): + ovlan = vlan + if vlan == 'off': + vlan = b'\x00\x00' + else: + vlan = int(vlan) + if vlan: + vlan = vlan | 32768 + vlan = struct.pack('