aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/api/responders/resource/aggregates.py4
-rw-r--r--app/api/responders/resource/clique_constraints.py13
-rw-r--r--app/api/responders/resource/clique_types.py26
-rw-r--r--app/api/responders/resource/cliques.py17
-rw-r--r--app/api/responders/resource/connection_tests.py10
-rw-r--r--app/api/responders/resource/constants.py7
-rw-r--r--app/api/responders/resource/environment_configs.py41
-rw-r--r--app/api/responders/resource/inventory.py17
-rw-r--r--app/api/responders/resource/links.py21
-rw-r--r--app/api/responders/resource/messages.py19
-rw-r--r--app/api/responders/resource/monitoring_config_templates.py17
-rw-r--r--app/api/responders/resource/scans.py17
-rw-r--r--app/api/responders/resource/scheduled_scans.py33
-rw-r--r--app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py4
-rw-r--r--app/discover/fetchers/cli/cli_fetch_vservice_vnics.py22
-rw-r--r--app/install/db/attributes_for_hover_on_data.json66
-rw-r--r--app/install/db/constants.json4
-rw-r--r--app/install/db/supported_environments.json13
18 files changed, 213 insertions, 138 deletions
diff --git a/app/api/responders/resource/aggregates.py b/app/api/responders/resource/aggregates.py
index d0b8031..ca4610e 100644
--- a/app/api/responders/resource/aggregates.py
+++ b/app/api/responders/resource/aggregates.py
@@ -12,9 +12,11 @@ from api.validation.data_validate import DataValidate
class Aggregates(ResponderBase):
+
+ AGGREGATE_TYPES = ["environment", "message", "constant"]
+
def __init__(self):
super().__init__()
- self.AGGREGATE_TYPES = ["environment", "message", "constant"]
self.AGGREGATES_MAP = {
"environment": self.get_environments_aggregates,
"message": self.get_messages_aggregates,
diff --git a/app/api/responders/resource/clique_constraints.py b/app/api/responders/resource/clique_constraints.py
index 09fa782..1761f8c 100644
--- a/app/api/responders/resource/clique_constraints.py
+++ b/app/api/responders/resource/clique_constraints.py
@@ -13,13 +13,12 @@ from bson.objectid import ObjectId
class CliqueConstraints(ResponderBase):
- def __init__(self):
- super().__init__()
- self.ID = '_id'
- self.PROJECTION = {
- self.ID: True
- }
- self.COLLECTION = 'clique_constraints'
+
+ COLLECTION = 'clique_constraints'
+ ID = '_id'
+ PROJECTION = {
+ ID: True
+ }
def on_get(self, req, resp):
self.log.debug("Getting clique_constraints")
diff --git a/app/api/responders/resource/clique_types.py b/app/api/responders/resource/clique_types.py
index a2bfa75..ff42f8c 100644
--- a/app/api/responders/resource/clique_types.py
+++ b/app/api/responders/resource/clique_types.py
@@ -13,17 +13,17 @@ from bson.objectid import ObjectId
class CliqueTypes(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = "clique_types"
- self.ID = "_id"
- self.PROJECTION = {
- self.ID: True,
- "focal_point_type": True,
- "link_types": True,
- "environment": True,
- "name": True
- }
+
+ COLLECTION = "clique_types"
+ ID = "_id"
+ PROJECTION = {
+ ID: True,
+ "focal_point_type": True,
+ "link_types": True,
+ "environment": True,
+ "name": True
+ }
+ RESERVED_NAMES = ["ANY"]
def on_get(self, req, resp):
self.log.debug("Getting clique types")
@@ -83,7 +83,9 @@ class CliqueTypes(ResponderBase):
env_name = clique_type['environment']
if not self.check_environment_name(env_name):
- self.bad_request("unknown environment: " + env_name)
+ self.bad_request("Unknown environment: {}".format(env_name))
+ elif env_name.upper() in self.RESERVED_NAMES:
+ self.bad_request("Environment name '{}' is reserved".format(env_name))
self.write(clique_type, self.COLLECTION)
self.set_successful_response(resp,
diff --git a/app/api/responders/resource/cliques.py b/app/api/responders/resource/cliques.py
index a81ab00..60f1133 100644
--- a/app/api/responders/resource/cliques.py
+++ b/app/api/responders/resource/cliques.py
@@ -15,15 +15,14 @@ from utils.util import generate_object_ids
class Cliques(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = "cliques"
- self.ID = '_id'
- self.PROJECTION = {
- self.ID: True,
- "focal_point_type": True,
- "environment": True
- }
+
+ COLLECTION = "cliques"
+ ID = '_id'
+ PROJECTION = {
+ ID: True,
+ "focal_point_type": True,
+ "environment": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting cliques")
diff --git a/app/api/responders/resource/connection_tests.py b/app/api/responders/resource/connection_tests.py
index 8f8ab94..cb4865d 100644
--- a/app/api/responders/resource/connection_tests.py
+++ b/app/api/responders/resource/connection_tests.py
@@ -24,14 +24,14 @@ class ConnectionTests(ResponderBase):
RESULTS = "test_results"
CONFIGURATIONS = "targets_configuration"
STATUSES = ["request", "response"]
+ PROJECTION = {
+ ID: True,
+ TARGETS: True,
+ RESULTS: True
+ }
def __init__(self):
super().__init__()
- self.PROJECTION = {
- self.ID: True,
- self.TARGETS: True,
- self.RESULTS: True
- }
self.allowed_targets = \
self.get_constants_by_name("configuration_targets")
diff --git a/app/api/responders/resource/constants.py b/app/api/responders/resource/constants.py
index be71b5d..26fbbc3 100644
--- a/app/api/responders/resource/constants.py
+++ b/app/api/responders/resource/constants.py
@@ -12,10 +12,9 @@ from bson.objectid import ObjectId
class Constants(ResponderBase):
- def __init__(self):
- super().__init__()
- self.ID = '_id'
- self.COLLECTION = 'constants'
+
+ COLLECTION = 'constants'
+ ID = '_id'
def on_get(self, req, resp):
self.log.debug("Getting constants with name")
diff --git a/app/api/responders/resource/environment_configs.py b/app/api/responders/resource/environment_configs.py
index f54bea7..c24aec8 100644
--- a/app/api/responders/resource/environment_configs.py
+++ b/app/api/responders/resource/environment_configs.py
@@ -17,22 +17,22 @@ from utils.inventory_mgr import InventoryMgr
class EnvironmentConfigs(ResponderBase):
- def __init__(self):
- super(EnvironmentConfigs, self).__init__()
- self.inv = InventoryMgr()
- self.ID = "name"
- self.PROJECTION = {
- self.ID: True,
- "_id": False,
- "name": True,
- "distribution": True
- }
- self.COLLECTION = "environments_config"
- self.CONFIGURATIONS_NAMES = ["mysql", "OpenStack",
- "CLI", "AMQP", "Monitoring",
+
+ COLLECTION = "environments_config"
+ ID = "name"
+ PROJECTION = {
+ ID: True,
+ "_id": False,
+ "name": True,
+ "distribution": True
+ }
+ CONFIGURATIONS_NAMES = ["mysql", "OpenStack", "CLI", "AMQP",
+ "Monitoring", "NFV_provider", "ACI"]
+ OPTIONAL_CONFIGURATIONS_NAMES = ["AMQP", "Monitoring",
"NFV_provider", "ACI"]
- self.OPTIONAL_CONFIGURATIONS_NAMES = ["AMQP", "Monitoring",
- "NFV_provider", "ACI"]
+
+ def __init__(self):
+ super().__init__()
self.provision_types = self.\
get_constants_by_name("environment_provision_types")
@@ -41,6 +41,8 @@ class EnvironmentConfigs(ResponderBase):
get_constants_by_name("environment_monitoring_types")
self.distributions = self.\
get_constants_by_name("distributions")
+ self.distribution_versions = self.\
+ get_constants_by_name("distribution_versions")
self.mechanism_drivers = self.\
get_constants_by_name("mechanism_drivers")
self.operational_values = self.\
@@ -183,6 +185,9 @@ class EnvironmentConfigs(ResponderBase):
"distribution": self.require(str,
validate=DataValidate.LIST,
requirement=self.distributions),
+ "distribution_version": self.require(str,
+ validate=DataValidate.LIST,
+ requirement=self.distribution_versions),
"mechanism_drivers": self.require([str, list],
validate=DataValidate.LIST,
requirement=self.mechanism_drivers),
@@ -216,9 +221,9 @@ class EnvironmentConfigs(ResponderBase):
def build_query(self, filters):
query = {}
- filters_keys = ["name", "distribution", "type_drivers", "user",
- "listen", "monitoring_setup_done", "scanned",
- "operational"]
+ filters_keys = ["name", "distribution", "distribution_version",
+ "type_drivers", "user", "listen",
+ "monitoring_setup_done", "scanned", "operational"]
self.update_query_with_filters(filters, filters_keys, query)
mechanism_drivers = filters.get("mechanism_drivers")
if mechanism_drivers:
diff --git a/app/api/responders/resource/inventory.py b/app/api/responders/resource/inventory.py
index 6712197..5ae0bde 100644
--- a/app/api/responders/resource/inventory.py
+++ b/app/api/responders/resource/inventory.py
@@ -13,15 +13,14 @@ from datetime import datetime
class Inventory(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = 'inventory'
- self.ID = 'id'
- self.PROJECTION = {
- self.ID: True,
- "name": True,
- "name_path": True
- }
+
+ COLLECTION = 'inventory'
+ ID = 'id'
+ PROJECTION = {
+ ID: True,
+ "name": True,
+ "name_path": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting objects from inventory")
diff --git a/app/api/responders/resource/links.py b/app/api/responders/resource/links.py
index bd0a022..d700bad 100644
--- a/app/api/responders/resource/links.py
+++ b/app/api/responders/resource/links.py
@@ -13,17 +13,16 @@ from bson.objectid import ObjectId
class Links(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = 'links'
- self.ID = '_id'
- self.PROJECTION = {
- self.ID: True,
- "link_name": True,
- "link_type": True,
- "environment": True,
- "host": True
- }
+
+ COLLECTION = 'links'
+ ID = '_id'
+ PROJECTION = {
+ ID: True,
+ "link_name": True,
+ "link_type": True,
+ "environment": True,
+ "host": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting links from links")
diff --git a/app/api/responders/resource/messages.py b/app/api/responders/resource/messages.py
index 367bd34..ff64fbc 100644
--- a/app/api/responders/resource/messages.py
+++ b/app/api/responders/resource/messages.py
@@ -15,16 +15,15 @@ from bson.objectid import ObjectId
class Messages(ResponderBase):
- def __init__(self):
- super().__init__()
- self.ID = "id"
- self.COLLECTION = 'messages'
- self.PROJECTION = {
- self.ID: True,
- "environment": True,
- "source_system": True,
- "level": True
- }
+
+ COLLECTION = 'messages'
+ ID = "id"
+ PROJECTION = {
+ ID: True,
+ "environment": True,
+ "source_system": True,
+ "level": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting messages from messages")
diff --git a/app/api/responders/resource/monitoring_config_templates.py b/app/api/responders/resource/monitoring_config_templates.py
index 8980cc9..3162168 100644
--- a/app/api/responders/resource/monitoring_config_templates.py
+++ b/app/api/responders/resource/monitoring_config_templates.py
@@ -13,15 +13,14 @@ from bson.objectid import ObjectId
class MonitoringConfigTemplates(ResponderBase):
- def __init__(self):
- super().__init__()
- self.ID = "_id"
- self.COLLECTION = "monitoring_config_templates"
- self.PROJECTION = {
- self.ID: True,
- "side": True,
- "type": True
- }
+
+ COLLECTION = "monitoring_config_templates"
+ ID = "_id"
+ PROJECTION = {
+ ID: True,
+ "side": True,
+ "type": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting monitoring config template")
diff --git a/app/api/responders/resource/scans.py b/app/api/responders/resource/scans.py
index 6fc572d..30b8dd6 100644
--- a/app/api/responders/resource/scans.py
+++ b/app/api/responders/resource/scans.py
@@ -14,15 +14,14 @@ from datetime import datetime
class Scans(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = "scans"
- self.ID = "_id"
- self.PROJECTION = {
- self.ID: True,
- "environment": True,
- "status": True
- }
+
+ COLLECTION = "scans"
+ ID = "_id"
+ PROJECTION = {
+ ID: True,
+ "environment": True,
+ "status": True
+ }
def on_get(self, req, resp):
self.log.debug("Getting scans")
diff --git a/app/api/responders/resource/scheduled_scans.py b/app/api/responders/resource/scheduled_scans.py
index f8cf92c..e9d6a34 100644
--- a/app/api/responders/resource/scheduled_scans.py
+++ b/app/api/responders/resource/scheduled_scans.py
@@ -14,23 +14,22 @@ from datetime import datetime
class ScheduledScans(ResponderBase):
- def __init__(self):
- super().__init__()
- self.COLLECTION = "scheduled_scans"
- self.ID = "_id"
- self.PROJECTION = {
- self.ID: True,
- "environment": True,
- "scheduled_timestamp": True,
- "freq": True
- }
- self.SCAN_FREQ = [
- "YEARLY",
- "MONTHLY",
- "WEEKLY",
- "DAILY",
- "HOURLY"
- ]
+
+ COLLECTION = "scheduled_scans"
+ ID = "_id"
+ PROJECTION = {
+ ID: True,
+ "environment": True,
+ "scheduled_timestamp": True,
+ "freq": True
+ }
+ SCAN_FREQ = [
+ "YEARLY",
+ "MONTHLY",
+ "WEEKLY",
+ "DAILY",
+ "HOURLY"
+ ]
def on_get(self, req, resp):
self.log.debug("Getting scheduled scans")
diff --git a/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py b/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py
index 77f149f..d988c35 100644
--- a/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py
+++ b/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py
@@ -37,7 +37,7 @@ class CliFetchBondHostPnics(CliAccess):
if lines and 'No such file or directory' in lines[0]:
return [] # no bonds so directory does not exist
bonds = []
- for line in lines:
+ for line in [l.strip() for l in lines]:
bond = self.get_bond_details(host_id, line)
if bond:
bonds.append(bond)
@@ -123,7 +123,7 @@ class CliFetchBondHostPnics(CliAccess):
})
if not pnic:
self.log.error('unable to find slave pNIC {} under bond {}'
- .format(slave_id, interface_id))
+ .format(slave['name'], interface_id))
return
mac_address = pnic['mac_address']
slave_id = '{}-{}'.format(slave.get('name', ''), mac_address)
diff --git a/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py b/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py
index 2e074f8..3bc3a5b 100644
--- a/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py
+++ b/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py
@@ -21,7 +21,7 @@ class CliFetchVserviceVnics(CliAccess):
self.regexps = [
{'name': 'mac_address', 're': '^.*\slink/ether\s(\S+)\s'},
{'name': 'IP Address', 're': '^\s*inet ([0-9.]+)/'},
- {'name': 'netmask', 're': '^.*\slink/ether\s[^/]+/(\S+)'},
+ {'name': 'netmask', 're': '^\s*inet [0-9.]+/([0-9]+)'},
{'name': 'IPv6 Address',
're': '^\s*inet6 ([^/]+)/.* global '}
]
@@ -138,6 +138,8 @@ class CliFetchVserviceVnics(CliAccess):
@staticmethod
def convert_netmask(cidr):
netmask_conversion = {
+ '32': '255.255.255.255',
+ '31': '255.255.255.254',
'30': '255.255.255.252',
'29': '255.255.255.248',
'28': '255.255.255.240',
@@ -152,7 +154,23 @@ class CliFetchVserviceVnics(CliAccess):
'19': '255.255.224.0',
'18': '255.255.192.0',
'17': '255.255.128.0',
- '16': '255.255.0.0'
+ '16': '255.255.0.0',
+ '15': '255.254.0.0',
+ '14': '255.252.0.0',
+ '13': '255.248.0.0',
+ '12': '255.240.0.0',
+ '11': '255.224.0.0',
+ '10': '255.192.0.0',
+ '9': '255.128.0.0',
+ '8': '255.0.0.0',
+ '7': '254.0.0.0',
+ '6': '252.0.0.0',
+ '5': '248.0.0.0',
+ '4': '240.0.0.0',
+ '3': '224.0.0.0',
+ '2': '192.0.0.0',
+ '1': '128.0.0.0',
+ '0': '0.0.0.0'
}
if cidr not in netmask_conversion:
raise ValueError('can''t convert to netmask: {}'.format(cidr))
diff --git a/app/install/db/attributes_for_hover_on_data.json b/app/install/db/attributes_for_hover_on_data.json
index aadcbe8..d1fbe04 100644
--- a/app/install/db/attributes_for_hover_on_data.json
+++ b/app/install/db/attributes_for_hover_on_data.json
@@ -3,9 +3,12 @@
"attributes" : [
"object_name",
"model",
- "mac_address",
- "type",
- "koren"
+ "mac_address",
+ "vnic_type",
+ "data",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "vnic"
},
@@ -14,7 +17,10 @@
"object_name",
"connector_type",
"type",
- "interfaces"
+ "interfaces",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "vconnector"
},
@@ -23,7 +29,10 @@
"object_name",
"host",
"service_type",
- "type"
+ "type",
+ "status_text",
+ "status",
+ "status_timestamp"
],
"type" : "vservice"
},
@@ -32,8 +41,13 @@
"object_name",
"host",
"agent_type",
- "binary",
- "type"
+ "binary",
+ "started_at",
+ "heartbeat_timestamp",
+ "type",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "vedge"
},
@@ -44,7 +58,13 @@
"mac_address",
"Speed",
"Link detected",
- "type"
+ "type",
+ "Bonding Mode",
+ "Ethernet Channel Bonding Driver",
+ "members",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "host_pnic"
},
@@ -53,7 +73,11 @@
"object_name",
"provider:segmentation_id",
"provider:network_type",
- "type"
+ "type",
+ "status",
+ "port_security_enabled",
+ "availability_zones",
+ "mtu"
],
"type" : "network"
},
@@ -61,18 +85,25 @@
"attributes" : [
"object_name",
"host_type",
- "parent_id",
- "type"
+ "services",
+ "type",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "host"
},
{
"attributes" : [
- "object_name",
+ "object_name",
+ "local_name",
"host",
"project",
"type",
- "name_path"
+ "name_path",
+ "status",
+ "status_timestamp",
+ "status_text"
],
"type" : "instance"
},
@@ -93,5 +124,14 @@
"parent_id",
"role"
]
+},
+{
+ "attributes" : [
+ "link_type",
+ "status",
+ "status_timestamp",
+ "status_text"
+ ],
+ "type" : "link"
}
]
diff --git a/app/install/db/constants.json b/app/install/db/constants.json
index 15522b7..6912eeb 100644
--- a/app/install/db/constants.json
+++ b/app/install/db/constants.json
@@ -532,6 +532,10 @@
{
"value" : "10918",
"label" : "10918"
+ },
+ {
+ "label" : "11190",
+ "value" : "11190"
}
]
},
diff --git a/app/install/db/supported_environments.json b/app/install/db/supported_environments.json
index 0d507c3..c2c376b 100644
--- a/app/install/db/supported_environments.json
+++ b/app/install/db/supported_environments.json
@@ -54,6 +54,19 @@
{
"features" : {
"listening" : true,
+ "scanning" : true,
+ "monitoring" : true
+ },
+ "environment" : {
+ "type_drivers" : "vlan",
+ "mechanism_drivers" : "OVS",
+ "distribution" : "Mercury",
+ "distribution_version" : ["11190"]
+ }
+ },
+ {
+ "features" : {
+ "listening" : true,
"monitoring" : true,
"scanning" : true
},