Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 42 additions & 20 deletions doc/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ Basic Usage
Before using Spyglass you must:


1. Clone the Tugboat repository:
1. Clone the Spyglass repository:

.. code-block:: console

git clone https://github.com/att-comdev/tugboat/tree/spyglass

2. Install the required packages in spyglass/:
2. Install the required packages in spyglass:

.. code-block:: console

Expand All @@ -87,24 +87,46 @@ CLI Options
Usage: spyglass [OPTIONS]

Options:
-s, --site TEXT Specify the site for which manifests to be
generated
-t, --type TEXT Specify the plugin type formation or tugboat
-f, --formation_url TEXT Specify the formation url
-u, --formation_user TEXT Specify the formation user id
-p, --formation_password TEXT Specify the formation user password
-d, --additional_config PATH Site specific configuraton details
-g, --generate_intermediary Dump intermediary file from passed excel and
excel spec
-m, --generate_manifests Generate manifests from the generated
intermediary file
-l, --loglevel INTEGER Loglevel NOTSET:0 ,DEBUG:10, INFO:20,
WARNING:30, ERROR:40, CRITICAL:50 [default:
20]
--help Show this message and exit.


1. Running Spyglass with Remote Data Source
-s, --site TEXT Specify the site for which manifests to be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create plugin as the sub command to spyglass, this will cleanup this help to an extent.

e.g.: spyglass [options] plugin_name [ options]
spyglass --loglevel 10 tugboat ...

generated
-t, --type TEXT Specify the plugin type formation or tugboat
-f, --formation_url TEXT Specify the formation url
-u, --formation_user TEXT Specify the formation user id
-p, --formation_password TEXT Specify the formation user password
-i, --intermediary PATH Intermediary file path generate manifests,
use -m also with this option
-d, --additional_config PATH Site specific configuraton details
-g, --generate_intermediary Dump intermediary file from passed excel and
excel spec
-idir, --intermediary_dir PATH The path where intermediary file needs to be
generated
-e, --edit_intermediary / -nedit, --no_edit_intermediary
Flag to let user edit intermediary
-m, --generate_manifests Generate manifests from the generated
intermediary file
-mdir, --manifest_dir PATH The path where manifest files needs to be
generated
-x, --excel PATH Path to engineering excel file, to be passed
with generate_intermediary
-e, --excel_spec PATH Path to excel spec, to be passed with
generate_intermediary
-l, --loglevel INTEGER Loglevel NOTSET:0 ,DEBUG:10, INFO:20,
WARNING:30, ERROR:40, CRITICAL:50 [default:
20]
--help Show this message and exit.


1. Running Spyglass with Remote Data Source Plugin

spyglass -mg --type formation -f <URL> -u <user_id> -p <password> -d <site_config> -s <sitetype>

2. Running Spyglass with Excel Plugin

spyglass -mg --type tugboat -x <Excel File> -e <Excel Spec> -d <Site Config> -s <Region>

for example:
spyglass -mg -t tugboat -x SiteDesignSpec_v0.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy
Where 'excel_spec_upstream.yaml', 'SiteDesignSpec_v0.1.xlsx' and
'site_config.yaml' are sample excel specificaton and file from
spyglass/sample folder.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
],
'data_extractor_plugins':
['formation=spyglass.data_extractor.formation:FormationPlugin',
'tugboat=spyglass.data_extractor.tugboat:TugboatPlugin',
'tugboat=spyglass.data_extractor.tugboat.tugboat:TugboatPlugin',
]
},
include_package_data=True,
Expand Down
60 changes: 4 additions & 56 deletions spyglass/config/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,64 +27,12 @@ rule_ip_alloc_offset:
ingress_vip: 1
static_ip_end: -2
dhcp_ip_end: -2
rule_host_profile_interfaces:
name: host_profile_interfaces
host_profile_interfaces:
gv:
networks:
p1p1: sriov_nic01
bond1:
- gp_nic01
- gp_nic02
p3p2: sriov_nic02
nsb:
networks:
p1p1: sriov_nic01
bond1:
- gp_nic01
- gp_nic02
pxe: en04
p3p2: sriov_nic02
cp:
networks:
p1p1: sriov_nic01
bond1:
- gp_nic01
- gp_nic02
p3p2: sriov_nic02
ns:
networks:
p1p1: sriov_nic01
bond1:
- gp_nic01
- gp_nic02
pxe: en04
p3p2: sriov_nic02
rule_hardware_profile:
name: hardware_profile
hardware_profile:
nc:
foundry:
profile_name:
compute: nsb
ctrl: cp
host_type:
compute: nc-ns-r740
ctrl: nc-cp
hw_type: dell_r740_purley_nc
5ec:
profile_name:
compute: nsb
ctrl: cp
host_type:
compute: 5ec-ns-r640
ctrl: 5ec-cp
hw_type: dell_r640_purley_5ec
cruiser:
profile_name:
compute: nsb
ctrl: cp
host_type:
compute: nc-ns-r740
ctrl: nc-cp
hw_type: dell_r740_purley_nc
compute: dp-r720
ctrl: cp-r720
hw_type: dell_r720
...
45 changes: 14 additions & 31 deletions spyglass/data_extractor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def extract_baremetal_information(self):
"""
LOG.info("Extract baremetal information from plugin")
baremetal = {}
is_genesis = False
hosts = self.get_hosts(self.region)

# For each host list fill host profile and network IPs
Expand All @@ -301,40 +300,23 @@ def extract_baremetal_information(self):

# Fill network IP for this host
temp_host['ip'] = {}
temp_host['ip']['oob'] = temp_host_ips[host_name].get('oob', "")
temp_host['ip']['oob'] = temp_host_ips[host_name].get(
'oob', "#CHANGE_ME")
temp_host['ip']['calico'] = temp_host_ips[host_name].get(
'calico', "")
temp_host['ip']['oam'] = temp_host_ips[host_name].get('oam', "")
'calico', "#CHANGE_ME")
temp_host['ip']['oam'] = temp_host_ips[host_name].get(
'oam', "#CHANGE_ME")
temp_host['ip']['storage'] = temp_host_ips[host_name].get(
'storage', "")
'storage', "#CHANGE_ME")
temp_host['ip']['overlay'] = temp_host_ips[host_name].get(
'overlay', "")
# TODO(pg710r): Testing only.
'overlay', "#CHANGE_ME")
temp_host['ip']['pxe'] = temp_host_ips[host_name].get(
'pxe', "#CHANGE_ME")

# TODO(nh863p): Can this logic goes into dervied plugin class
# How to determine genesis node??

# TODO(nh863p): If below logic is based on host profile name, then
# it should be part of design rule???
# Filling rack_type( compute/controller/genesis)
# "cp" host profile is controller
# "ns" host profile is compute
if (temp_host['host_profile'] == 'cp'):
# The controller node is designates as genesis"
if is_genesis is False:
is_genesis = True
temp_host['type'] = 'genesis'
else:
temp_host['type'] = 'controller'
else:
temp_host['type'] = 'compute'
temp_host['type'] = host.get('type', "#CHANGE_ME")

baremetal[rack_name][host_name] = temp_host
LOG.debug("Baremetal information:\n{}".format(
pprint.pformat(baremetal)))

return baremetal

def extract_site_information(self):
Expand Down Expand Up @@ -414,12 +396,12 @@ def extract_network_information(self):
'calico', 'overlay', 'pxe', 'storage', 'oam', 'oob', 'ingress'
]
network_data['vlan_network_data'] = {}

for net in networks:
tmp_net = {}
if net['name'] in networks_to_scan:
tmp_net['subnet'] = net['subnet']
tmp_net['vlan'] = net['vlan']
tmp_net['subnet'] = net.get('subnet', '#CHANGE_ME')
if ((net['name'] != 'ingress') and (net['name'] != 'oob')):
tmp_net['vlan'] = net.get('vlan', '#CHANGE_ME')

network_data['vlan_network_data'][net['name']] = tmp_net

Expand All @@ -436,9 +418,10 @@ def extract_data(self):
LOG.info("Extract data from plugin")
site_data = {}
site_data['baremetal'] = self.extract_baremetal_information()
site_data['site_info'] = self.extract_site_information()
site_data['network'] = self.extract_network_information()
site_data['site_info'] = self.extract_site_information()
self.site_data = site_data

return site_data

def apply_additional_data(self, extra_data):
Expand All @@ -450,7 +433,7 @@ def apply_additional_data(self, extra_data):
If there is repetition of data then additional data supplied
shall take precedence.
"""
LOG.info("Update site data with additional input")
LOG.info("Merging site data with additional configuration")
tmp_site_data = utils.dict_merge(self.site_data, extra_data)
self.site_data = tmp_site_data
return self.site_data
Loading