mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-29 08:41:00 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e40c362743 | |||
| cafbc1d1c2 | |||
| 797e197bc7 | |||
| 19d4a3a83f | |||
| 874947076d | |||
| ffe0754dd9 | |||
| bbb8e50c3e | |||
| 4f246e6a41 | |||
| c53e758170 | |||
| 1a7c238b54 | |||
| 94a4a7e20b | |||
| c9157b90eb | |||
| 5d0423c38b | |||
| e583d34555 | |||
| 95466392f9 | |||
| b3857f8d33 | |||
| 7eb06f2722 | |||
| 8cf264602d | |||
| a2f5b11185 | |||
| a9e39eab96 | |||
| d29d2bf683 | |||
| 6458eac93b | |||
| 8df15b3a54 | |||
| b4f9bb78ae | |||
| c8e1efecdb | |||
| 22dc852277 | |||
| 784ac5ecba | |||
| 66c9777b3c | |||
| dba4c40f0e | |||
| 6997508a0c |
@@ -1,7 +1,6 @@
|
||||
*.pyc
|
||||
.*.
|
||||
confluent_client/man/man*
|
||||
confluent_client/doc/man
|
||||
.vscode
|
||||
.*.sw*
|
||||
.sw*
|
||||
|
||||
@@ -948,6 +948,8 @@ def main():
|
||||
clearpowermessage = False
|
||||
try:
|
||||
sys.stdout.write(data)
|
||||
except UnicodeEncodeError:
|
||||
sys.stdout.buffer.write(data.encode('utf8'))
|
||||
except IOError: # Some times circumstances are bad
|
||||
# resort to byte at a time...
|
||||
for d in data:
|
||||
|
||||
@@ -278,7 +278,6 @@ if setmode:
|
||||
rcode |= client.printerror(fr)
|
||||
for node in fr.get('databynode', []):
|
||||
r = fr['databynode'][node]
|
||||
rcode |= client.printerror(r, node)
|
||||
if 'value' not in r:
|
||||
continue
|
||||
keyval = r['value']
|
||||
|
||||
@@ -149,7 +149,6 @@ def show_firmware(session):
|
||||
if 'databynode' not in res:
|
||||
continue
|
||||
for node in res['databynode']:
|
||||
exitcode |= client.printerror(res['databynode'][node], node)
|
||||
if 'firmware' not in res['databynode'][node]:
|
||||
continue
|
||||
for inv in res['databynode'][node]['firmware']:
|
||||
|
||||
@@ -187,5 +187,7 @@ def main():
|
||||
argparser.print_help()
|
||||
sys.exit(1)
|
||||
handler(noderange, media)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(exitcode)
|
||||
|
||||
@@ -32,7 +32,7 @@ if path.startswith('/opt'):
|
||||
import confluent.client as client
|
||||
|
||||
argparser = optparse.OptionParser(
|
||||
usage='Usage: %prog [options] noderange [default|cd|network|setup|hd|floppy]')
|
||||
usage='Usage: %prog [options] noderange [default|cd|network|setup|hd|usb|floppy]')
|
||||
argparser.add_option('-b', '--bios', dest='biosmode',
|
||||
action='store_true', default=False,
|
||||
help='Request BIOS style boot (rather than UEFI)')
|
||||
|
||||
@@ -91,7 +91,7 @@ _confluent_nodeidentify_completion()
|
||||
|
||||
_confluent_nodesetboot_completion()
|
||||
{
|
||||
COMP_CANDIDATES=("default,cd,network,setup,hd,floppy -h -b -p")
|
||||
COMP_CANDIDATES=("default,cd,network,setup,hd,floppy,usb -h -b -p")
|
||||
_confluent_generic_completion
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ nodesetboot(8) -- Check or set next boot device for noderange
|
||||
## SYNOPSIS
|
||||
|
||||
`nodesetboot <noderange>`
|
||||
`nodesetboot [options] <noderange> [default|cd|network|setup|hd|floppy]`
|
||||
`nodesetboot [options] <noderange> [default|cd|network|setup|hd|usb|floppy]`
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
@@ -46,6 +46,10 @@ control.
|
||||
Request boot from floppy. Generally speaking firmware uses this to mean a USB
|
||||
flash drive or similar (whether virtual or physical).
|
||||
|
||||
* `usb`:
|
||||
Request boot from usb. Generally speaking firmware uses this to mean a USB
|
||||
flash drive or similar (whether virtual or physical).
|
||||
|
||||
* `network`:
|
||||
Request boot to network
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
stats(8) -- Common basic statistics on typical numeric data in output
|
||||
==============================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
`<other command> | stats [-c N] [-d D] [-x|-g|-t|-o image.png] [-s N] [-v] [-b N]
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
The **stats** command helps analyze common numerical data such as performance numbers
|
||||
or temperatures or any other numerical value.
|
||||
|
||||
By default it looks for the last numerical output on the first line to identify the numerical column
|
||||
and analyze that number. This can be overriden by **-c COLUMN** to indicate a column. By default,
|
||||
whitespace and commas are treated to delimit columns, and **-d DELIMITER** can be used to override.
|
||||
|
||||
By default it outputs basic statistics, but a histogram is available either text or through X11 output
|
||||
or sixel or output to an image file depending on whether **-x**, **-g**, **-t*, or **-o image.png** is
|
||||
used.
|
||||
|
||||
## OPTIONS
|
||||
|
||||
* `-c N`:
|
||||
Select column number. Defaults to last column that appears numeric
|
||||
|
||||
* `-d D`:
|
||||
Specify a custom column delimiter
|
||||
|
||||
* `-x`:
|
||||
Output in Sixel format (supported by mlterm and PuTTY, among others)
|
||||
|
||||
* `-g`:
|
||||
Try to open histogram as an X window
|
||||
|
||||
* `-t`:
|
||||
Output histogram as bars rendered by =
|
||||
|
||||
* `-o image.png`:
|
||||
Write graphical histogram to image.png.
|
||||
|
||||
* `-s N`:
|
||||
Ignore specified number of lines as header content before processing numbers
|
||||
|
||||
* `-v`:
|
||||
Treat value before : on each line as a label, and show which labels belong to which histogram buckets.
|
||||
|
||||
* `-b N`:
|
||||
Specify a custom number of buckets for histogram. The default is 10.
|
||||
|
||||
@@ -11,7 +11,7 @@ if lspci -d 15b3:: -n |grep 15b3 > /dev/null; then
|
||||
#mkdir MLNX_OFED
|
||||
#mount -o loop ofed.iso MLNX_OFED
|
||||
fetch_remote infiniband/mofed.tgz
|
||||
tar xf mofed.tgz
|
||||
tar xf infiniband/mofed.tgz
|
||||
# The rest is common between tar and iso
|
||||
cd MLNX_OFED*
|
||||
mount -o loop ofed
|
||||
|
||||
@@ -109,5 +109,13 @@ done < /etc/confluent/confluent.deploycfg
|
||||
if [ -e /lib/nm-lib.sh ]; then
|
||||
. /lib/nm-lib.sh
|
||||
nm_generate_connections
|
||||
if [[ "$ifname" == ib* ]]; then
|
||||
sed -i s/type=ethernet/type=infiniband/ /run/NetworkManager/system-connections/$ifname.nmconnection
|
||||
if ! grep '\[infiniband\]' /run/NetworkManager/system-connections/$ifname.nmconnection > /dev/null; then
|
||||
echo >> /run/NetworkManager/system-connections/$ifname.nmconnection
|
||||
echo '[infiniband]' >> /run/NetworkManager/system-connections/$ifname.nmconnection
|
||||
echo transport-mode=datagram >> /run/NetworkManager/system-connections/$ifname.nmconnection
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if lspci -d 15b3:: -n |grep 15b3 > /dev/null; then
|
||||
#mkdir MLNX_OFED
|
||||
#mount -o loop ofed.iso MLNX_OFED
|
||||
fetch_remote infiniband/mofed.tgz
|
||||
tar xf mofed.tgz
|
||||
tar xf infiniband/mofed.tgz
|
||||
# The rest is common between tar and iso
|
||||
cd MLNX_OFED*
|
||||
mount -o loop ofed
|
||||
|
||||
@@ -4,3 +4,8 @@ install --firstdisk --overwritevmfs
|
||||
%include /tmp/ksnet
|
||||
%include /tmp/rootpw
|
||||
reboot
|
||||
%post
|
||||
localcli network firewall unload
|
||||
STATUP=$(mktemp)
|
||||
echo '{"status": "complete"}' > $STATUP
|
||||
/opt/confluent/bin/apiclient /confluent-api/self/updatestatus $STATUP
|
||||
|
||||
@@ -8,14 +8,16 @@ if ! grep console= /proc/cmdline >& /dev/null; then
|
||||
echo $autocons > /tmp/01-autocons.devnode
|
||||
if [ ! -z "$autocons" ]; then
|
||||
echo "Using $(cat /tmp/01-autocons.conf)"
|
||||
tmux a <> $autocons >&0 2>&1 &
|
||||
(while :; do tmux a <> $autocons >&0 2>&1; done) &
|
||||
(while :; do TERM=linux tmux a <> /dev/tty1 >&0 2>&1; done) &
|
||||
else
|
||||
tmux a <> /dev/console >&0 2>&1 &
|
||||
(while :; do tmux a <> /dev/console >&0 2>&1; done) &
|
||||
fi
|
||||
else
|
||||
tmux a <> /dev/console >&0 2>&1 &
|
||||
tmux a <> /dev/tty1 >&0 2>&1 &
|
||||
(while :; do tmux a <> /dev/console >&0 2>&1; done) &
|
||||
(while :; do TERM=linux tmux a <> /dev/tty1 >&0 2>&1; done) &
|
||||
fi
|
||||
(while :; do TERM=linux tmux <> /dev/tty2 >&0 2>&1; done) &
|
||||
echo -n "udevd: "
|
||||
/usr/lib/systemd/systemd-udevd --daemon
|
||||
echo -n "Loading drivers..."
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
label: Genesis
|
||||
kernelarags: quiet
|
||||
kernelargs: quiet
|
||||
|
||||
@@ -411,7 +411,7 @@ def main():
|
||||
dotwait()
|
||||
while awaitprefix and not check_subnet(s, bmccfg['prefixv4'], channel):
|
||||
dotwait()
|
||||
while awaitprefix and not check_gateway(s, bmccfg['bmcgw'], channel):
|
||||
while awaitgw and not check_gateway(s, bmccfg['bmcgw'], channel):
|
||||
dotwait()
|
||||
sys.stdout.write('done\n')
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
@@ -20,20 +21,29 @@
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
struct termios tty;
|
||||
struct termios tty2;
|
||||
struct winsize ws;
|
||||
unsigned width, height;
|
||||
int ttyf;
|
||||
int spcr;
|
||||
int tmpi;
|
||||
int currspeed;
|
||||
int flags;
|
||||
speed_t cspeed;
|
||||
char buff[128];
|
||||
int bufflen;
|
||||
fd_set set;
|
||||
struct timeval timeout;
|
||||
char* offset;
|
||||
uint64_t address;
|
||||
spcr = open("/sys/firmware/acpi/tables/SPCR", O_RDONLY);
|
||||
if (spcr < 0) {
|
||||
bufflen = 0;
|
||||
tmpi = open("/sys/firmware/acpi/tables/SPCR", O_RDONLY);
|
||||
if (tmpi < 0) {
|
||||
exit(0);
|
||||
}
|
||||
if (read(spcr, buff, 80) < 80) {
|
||||
if (read(tmpi, buff, 80) < 80) {
|
||||
exit(0);
|
||||
}
|
||||
close(tmpi);
|
||||
if (buff[8] != 2) exit(0); //revision 2
|
||||
if (buff[36] != 0) exit(0); //16550 only
|
||||
if (buff[40] != 1) exit(0); //IO only
|
||||
@@ -69,12 +79,49 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
tcgetattr(ttyf, &tty);
|
||||
if (cspeed) {
|
||||
cfsetospeed(&tty, B115200);
|
||||
cfsetispeed(&tty, B115200);
|
||||
cfsetospeed(&tty, cspeed);
|
||||
cfsetispeed(&tty, cspeed);
|
||||
}
|
||||
printf("%s\n", buff);
|
||||
tcgetattr(ttyf, &tty2);
|
||||
cfmakeraw(&tty2);
|
||||
tcsetattr(ttyf, TCSANOW, &tty2);
|
||||
flags = fcntl(ttyf, F_GETFL, 0);
|
||||
fcntl(ttyf, F_SETFL, flags | O_NONBLOCK);
|
||||
while (read(ttyf, buff, 64) > 0) {
|
||||
// Drain any pending reads
|
||||
}
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 500000;
|
||||
FD_ZERO(&set);
|
||||
FD_SET(ttyf, &set);
|
||||
write(ttyf, "\0337\033[999;999H\033[6n\0338", 18);
|
||||
while (select(ttyf + 1, &set, NULL, NULL, &timeout) > 0) {
|
||||
if ((tmpi = read(ttyf, buff + bufflen, 127 - bufflen)) < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
bufflen += tmpi;
|
||||
buff[bufflen] = 0;
|
||||
if (strchr(buff, 'R')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fcntl(ttyf, F_SETFL, flags);
|
||||
ws.ws_xpixel = 0;
|
||||
ws.ws_ypixel = 0;
|
||||
if (sscanf(buff, "\033[%u;%uR", &height, &width) == 2) {
|
||||
ws.ws_col = width;
|
||||
ws.ws_row = height;
|
||||
} else {
|
||||
ws.ws_col = 100;
|
||||
ws.ws_row = 31;
|
||||
}
|
||||
ioctl(ttyf, TIOCSWINSZ, &ws);
|
||||
tcsetattr(ttyf, TCSANOW, &tty);
|
||||
ioctl(ttyf, TIOCCONS, 0);
|
||||
printf("%s\n", buff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ if args[0] == 'restore':
|
||||
for targdir in os.walk('/etc/confluent'):
|
||||
os.chown(targdir[0], owner, group)
|
||||
for f in targdir[2]:
|
||||
os.chown(os.patht.join(targdir[0], f), owner, group)
|
||||
os.chown(os.path.join(targdir[0], f), owner, group)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(1)
|
||||
|
||||
@@ -785,7 +785,7 @@ def commit_clear():
|
||||
# currently defined as local to each collective member
|
||||
# currently just 'autosense' which is intended to be active
|
||||
# per collective member
|
||||
for globvar in _oldcfgstore['globals']:
|
||||
for globvar in _oldcfgstore.get('globals', ()):
|
||||
if globvar.endswith('_key'):
|
||||
continue
|
||||
_cfgstore['globals'][globvar] = _oldcfgstore['globals'][globvar]
|
||||
|
||||
@@ -811,13 +811,17 @@ def get_smm_neighbor_fingerprints(smmaddr, cv):
|
||||
if ':' in smmaddr:
|
||||
smmaddr = '[{0}]'.format(smmaddr)
|
||||
wc = webclient.SecureHTTPConnection(smmaddr, verifycallback=cv)
|
||||
neighs = wc.grab_json_response('/scripts/neighdata.json')
|
||||
try:
|
||||
neighs = wc.grab_json_response('/scripts/neighdata.json')
|
||||
except Exception:
|
||||
log.log({'error': 'Failure getting LLDP information from {}'.format(smmaddr)})
|
||||
return
|
||||
if not neighs:
|
||||
return
|
||||
for idx in (4, 5):
|
||||
if 'sha256' not in neighs[idx]:
|
||||
for neigh in neighs:
|
||||
if 'sha256' not in neigh:
|
||||
continue
|
||||
yield 'sha256$' + b64tohex(neighs[idx]['sha256'])
|
||||
yield 'sha256$' + b64tohex(neigh['sha256'])
|
||||
|
||||
|
||||
def get_nodename(cfg, handler, info):
|
||||
|
||||
@@ -27,7 +27,16 @@ import confluent.netutil as netutil
|
||||
import confluent.util as util
|
||||
getaddrinfo = eventlet.support.greendns.getaddrinfo
|
||||
|
||||
from xml.etree.ElementTree import fromstring
|
||||
from xml.etree.ElementTree import fromstring as rfromstring
|
||||
|
||||
def fromstring(inputdata):
|
||||
if isinstance(inputdata, bytes):
|
||||
cmpstr = b'!entity'
|
||||
else:
|
||||
cmpstr = '!entity'
|
||||
if cmpstr in inputdata.lower():
|
||||
raise Exception('!ENTITY not supported in this interface')
|
||||
return rfromstring(inputdata)
|
||||
|
||||
def fixuuid(baduuid):
|
||||
# SMM dumps it out in hex
|
||||
|
||||
@@ -19,6 +19,7 @@ import confluent.util as util
|
||||
import confluent.log as log
|
||||
import os
|
||||
import random
|
||||
import eventlet.greenpool
|
||||
import eventlet.green.select as select
|
||||
import eventlet.green.socket as socket
|
||||
import struct
|
||||
@@ -106,6 +107,8 @@ def _parse_slp_packet(packet, peer, rsps, xidmap):
|
||||
if '%' in addr:
|
||||
addr = addr[:addr.index('%')]
|
||||
mac = None
|
||||
if addr not in neighutil.neightable:
|
||||
neighutil.update_neigh()
|
||||
if addr in neighutil.neightable:
|
||||
identifier = neighutil.neightable[addr]
|
||||
mac = identifier
|
||||
@@ -532,6 +535,8 @@ def active_scan(handler, protocol=None):
|
||||
for scanned in scan():
|
||||
for addr in scanned['addresses']:
|
||||
ip = addr[0].partition('%')[0] # discard scope if present
|
||||
if ip not in neighutil.neightable:
|
||||
neighutil.update_neigh()
|
||||
if ip not in neighutil.neightable:
|
||||
continue
|
||||
if addr in known_peers:
|
||||
@@ -583,6 +588,8 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False):
|
||||
# reduced chance of many responses overwhelming receive buffer.
|
||||
_grab_rsps((net, net4), rsps, 1, xidmap)
|
||||
# now to analyze and flesh out the responses
|
||||
handleids = set([])
|
||||
gp = eventlet.greenpool.GreenPool(128)
|
||||
for id in rsps:
|
||||
for srvurl in rsps[id].get('urls', ()):
|
||||
if len(srvurl) > 4:
|
||||
@@ -597,14 +604,22 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False):
|
||||
break
|
||||
else:
|
||||
continue
|
||||
_add_attributes(rsps[id])
|
||||
gp.spawn_n(_add_attributes, rsps[id])
|
||||
handleids.add(id)
|
||||
gp.waitall()
|
||||
for id in handleids:
|
||||
if 'service:lighttpd' in rsps[id]['services']:
|
||||
currinf = rsps[id]
|
||||
curratt = currinf.get('attributes', {})
|
||||
if curratt.get('System-Manufacturing', [None])[0] == 'Lenovo' and curratt.get('type', [None])[0] == 'LenovoThinkServer':
|
||||
currinf['services'] = ['service:lenovo-tsm']
|
||||
curratt['enclosure-serial-number'] = curratt['Product-Serial']
|
||||
curratt['enclosure-machinetype-model'] = curratt['Machine-Type']
|
||||
serialnumber = curratt.get('Product-Serial', curratt.get('SerialNumber', None))
|
||||
if serialnumber:
|
||||
curratt['enclosure-serial-number'] = serialnumber
|
||||
mtm = curratt.get('Machine-Type', curratt.get('Product-Name', None))
|
||||
if mtm:
|
||||
mtm[0] = mtm[0].rstrip()
|
||||
curratt['enclosure-machinetype-model'] = mtm
|
||||
else:
|
||||
continue
|
||||
del rsps[id]['payload']
|
||||
|
||||
@@ -62,6 +62,8 @@ def active_scan(handler, protocol=None):
|
||||
for scanned in scan(['urn:dmtf-org:service:redfish-rest:1']):
|
||||
for addr in scanned['addresses']:
|
||||
ip = addr[0].partition('%')[0] # discard scope if present
|
||||
if ip not in neighutil.neightable:
|
||||
neighutil.update_neigh()
|
||||
if ip not in neighutil.neightable:
|
||||
continue
|
||||
if addr in known_peers:
|
||||
@@ -311,6 +313,8 @@ def _parse_ssdp(peer, rsp, peerdata):
|
||||
ip = peer[0].partition('%')[0]
|
||||
nid = ip
|
||||
mac = None
|
||||
if ip not in neighutil.neightable:
|
||||
neighutil.update_neigh()
|
||||
if ip in neighutil.neightable:
|
||||
nid = neighutil.neightable[ip]
|
||||
mac = nid
|
||||
|
||||
@@ -1054,7 +1054,7 @@ class InputNetworkConfiguration(ConfluentInputMessage):
|
||||
if 'ipv4_gateway' not in inputdata:
|
||||
inputdata['ipv4_gateway'] = None
|
||||
|
||||
if 'ipv4_configuration' in inputdata:
|
||||
if 'ipv4_configuration' in inputdata and inputdata['ipv4_configuration']:
|
||||
if inputdata['ipv4_configuration'].lower() not in ['dhcp','static']:
|
||||
raise exc.InvalidArgumentException(
|
||||
'Unrecognized ipv4_configuration')
|
||||
@@ -1147,6 +1147,7 @@ class BootDevice(ConfluentChoiceMessage):
|
||||
'default',
|
||||
'cd',
|
||||
'floppy',
|
||||
'usb',
|
||||
])
|
||||
|
||||
valid_bootmodes = set([
|
||||
|
||||
@@ -82,8 +82,11 @@ _idxtoifnamemap = {}
|
||||
def _rebuildidxmap():
|
||||
_idxtoifnamemap.clear()
|
||||
for iname in os.listdir('/sys/class/net'):
|
||||
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
|
||||
_idxtoifnamemap[ci] = iname
|
||||
try:
|
||||
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
|
||||
_idxtoifnamemap[ci] = iname
|
||||
except Exception: # there may be non interface in /sys/class/net
|
||||
pass
|
||||
|
||||
|
||||
def myiptonets(svrip):
|
||||
|
||||
@@ -139,7 +139,10 @@ def get_fingerprint(switch, port, configmanager, portmatch):
|
||||
continue
|
||||
if info.get('switch', None) != switch:
|
||||
continue
|
||||
if portmatch(info.get('port'), port):
|
||||
if portmatch(info.get('portid', None), port):
|
||||
return ('sha256$' + b64tohex(info['peersha256fingerprint']),
|
||||
info.get('verified', False))
|
||||
elif portmatch(info.get('port', None), port):
|
||||
return ('sha256$' + b64tohex(info['peersha256fingerprint']),
|
||||
info.get('verified', False))
|
||||
return None, False
|
||||
@@ -235,19 +238,23 @@ def _extract_neighbor_data_b(args):
|
||||
idx = oidindex[0][-1]
|
||||
idxtoifname[idx] = _lldpdesc_to_ifname(sid, idx, str(oidindex[1]))
|
||||
for remotedesc in conn.walk('1.0.8802.1.1.2.1.4.1.1.10'):
|
||||
iname = idxtoifname[remotedesc[0][-2]]
|
||||
iname = idxtoifname.get(remotedesc[0][-2],
|
||||
idxtoportid[remotedesc[0][-2]])
|
||||
_init_lldp(lldpdata, iname, remotedesc[0][-2], idxtoportid, switch)
|
||||
_extract_extended_desc(lldpdata[iname], remotedesc[1], user)
|
||||
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.9'):
|
||||
iname = idxtoifname[remotename[0][-2]]
|
||||
iname = idxtoifname.get(remotename[0][-2],
|
||||
idxtoportid[remotename[0][-2]])
|
||||
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
|
||||
lldpdata[iname]['peername'] = str(remotename[1])
|
||||
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.7'):
|
||||
iname = idxtoifname[remotename[0][-2]]
|
||||
iname = idxtoifname.get(remotename[0][-2],
|
||||
idxtoportid[remotename[0][-2]])
|
||||
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
|
||||
lldpdata[iname]['peerportid'] = sanitize(remotename[1])
|
||||
for remoteid in conn.walk('1.0.8802.1.1.2.1.4.1.1.5'):
|
||||
iname = idxtoifname[remoteid[0][-2]]
|
||||
iname = idxtoifname.get(remoteid[0][-2],
|
||||
idxtoportid[remoteid[0][-2]])
|
||||
_init_lldp(lldpdata, iname, remoteid[0][-2], idxtoportid, switch)
|
||||
lldpdata[iname]['peerchassisid'] = sanitize(remoteid[1])
|
||||
for entry in lldpdata:
|
||||
|
||||
@@ -82,6 +82,8 @@ _blacklistnames = (
|
||||
|
||||
|
||||
def _namesmatch(switchdesc, userdesc):
|
||||
if switchdesc is None:
|
||||
return False
|
||||
if switchdesc == userdesc:
|
||||
return True
|
||||
try:
|
||||
@@ -217,13 +219,18 @@ def _map_switch_backend(args):
|
||||
*([int(x) for x in oid[-6:]])
|
||||
)
|
||||
mactobridge[macaddr] = int(bridgeport)
|
||||
#ciscoiftovlanmap = {}
|
||||
vlanstocheck = set([])
|
||||
for vb in conn.walk('.1.3.6.1.4.1.9.9.68.1.2.2.1.2'):
|
||||
vlanstocheck.add(vb[1])
|
||||
#ciscotrunktovlanmap = {}
|
||||
for vb in conn.walk('.1.3.6.1.4.1.9.9.46.1.6.1.1.5'):
|
||||
vlanstocheck.add(vb[1])
|
||||
try:
|
||||
#ciscoiftovlanmap = {}
|
||||
for vb in conn.walk('.1.3.6.1.4.1.9.9.68.1.2.2.1.2'):
|
||||
vlanstocheck.add(vb[1])
|
||||
#ciscotrunktovlanmap = {}
|
||||
for vb in conn.walk('.1.3.6.1.4.1.9.9.46.1.6.1.1.5'):
|
||||
vlanstocheck.add(vb[1])
|
||||
except Exception:
|
||||
# We might have crashed snmp on a non-cisco switch
|
||||
# in such a case, delay 8 seconds to allow recovery to complete
|
||||
eventlet.sleep(8)
|
||||
if not vlanstocheck:
|
||||
vlanstocheck.add(None)
|
||||
bridgetoifmap = {}
|
||||
|
||||
@@ -39,7 +39,7 @@ def makeboot_tree(distribution, profiledir):
|
||||
os.link('/var/lib/confluent/public/site/site-initramfs.gz', trginitramfs)
|
||||
profileinfo = os.path.join(profiledir, 'profile.yaml')
|
||||
with open(profileinfo) as info:
|
||||
profile = yaml.load(info)
|
||||
profile = yaml.safe_load(info)
|
||||
cfgfile = os.path.join(efidir, 'grub.cfg')
|
||||
with open(cfgfile, 'w') as grubcfg:
|
||||
grubcfg.write('set timeout=5\n')
|
||||
@@ -57,4 +57,4 @@ def makeboot_tree(distribution, profiledir):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
makeboot_tree(sys.argv[1], sys.argv[2])
|
||||
makeboot_tree(sys.argv[1], sys.argv[2])
|
||||
|
||||
Reference in New Issue
Block a user