Ian H Pittwood e84b80c32d Testing for plugin
Adds tests for the Excel plugin's parser and extractor.

Enables pep8 and fmt checks on the tests directory.

Increases plugin test coverage to 94%, sets new minimum to 92%.

Fixes DNS and NTP server extraction with regex.

Updates file licenses.

Change-Id: I35ee97574e6d63b7a82cfa94caf79db5db9755e7
2019-07-01 10:13:47 -05:00

160 lines
5.5 KiB
Python

# Copyright 2019 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
@pytest.fixture(scope='class')
def site_data(request):
request.cls.site_data = {
'ipmi_data': [
{
'cab2r72c12': {
'ipmi_address': '10.0.220.138',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'dp-r720'
},
'cab2r72c13': {
'ipmi_address': '10.0.220.139',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'dp-r720'
},
'cab2r72c14': {
'ipmi_address': '10.0.220.140',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'dp-r720'
},
'cab2r72c15': {
'ipmi_address': '10.0.220.141',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'dp-r720'
},
'cab2r72c16': {
'ipmi_address': '10.0.220.142',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'cp-r720'
},
'cab2r72c17': {
'ipmi_address': '10.0.220.143',
'ipmi_gateway': '10.0.220.129',
'host_profile': 'cp-r720'
},
'cab2r73c12': {
'ipmi_address': '10.0.220.170',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'dp-r720'
},
'cab2r73c13': {
'ipmi_address': '10.0.220.171',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'dp-r720'
},
'cab2r73c14': {
'ipmi_address': '10.0.220.172',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'dp-r720'
},
'cab2r73c15': {
'ipmi_address': '10.0.220.173',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'dp-r720'
},
'cab2r73c16': {
'ipmi_address': '10.0.220.174',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'cp-r720'
},
'cab2r73c17': {
'ipmi_address': '10.0.220.175',
'ipmi_gateway': '10.0.220.161',
'host_profile': 'cp-r720'
},
},
[
'cab2r72c12',
'cab2r72c13',
'cab2r72c14',
'cab2r72c15',
'cab2r72c16',
'cab2r72c17',
'cab2r73c12',
'cab2r73c13',
'cab2r73c14',
'cab2r73c15',
'cab2r73c16',
'cab2r73c17',
]
],
'network_data': {
'private': {
'iSCSI/Storage': {
'vlan': 'vlan 23',
'subnet': ['30.31.1.0/25'],
'is_common': True
},
'PXE': {
'vlan': 'vlan 21',
'subnet': [
'30.30.4.0/25', '30.30.4.128/25', '30.30.5.0/25',
'30.30.5.128/25'
],
'is_common': True
},
'Calico BGP peering addresses': {
'vlan': 'vlan 22',
'subnet': ['30.29.1.0/25'],
'is_common': True
},
'Overlay': {
'vlan': 'vlan 24',
'subnet': ['30.19.0.0/25'],
'is_common': True
}
},
'public': {
'oam': {
'subnet': ['10.0.220.0/26'],
'vlan': 'VLAN-21'
},
'ingress': '10.0.220.72/29',
'oob': {
'subnet': [
'10.0.220.128/27', '10.0.220.160/27',
'10.0.220.192/27', '10.0.220.224/27'
]
}
}
},
'site_info': {
'location': {
'corridor': 'Corridor 1',
'name': 'SampleSiteName',
'state': 'New Jersey',
'country': 'SampleCountry',
'physical_location': 'XXXXXX21'
},
'dns': [
'40.40.40.40', '(ntp1.example.com)', '41.41.41.41',
'(ntp2.example.com)'
],
'ntp': ['150.234.210.5', '(ns1.example.com)'],
'domain': 'dmy00.example.com',
'ldap': {
'subdomain': 'testitservices',
'common_name': 'AA-AAA-dmy00',
'url': 'url: ldap://ldap.example.com'
}
}
}