diff --git a/device-types/Nokia/7220-IXR-D1.yaml b/device-types/Nokia/7220-IXR-D1.yaml index 4cb2d4708..fa64e9301 100644 --- a/device-types/Nokia/7220-IXR-D1.yaml +++ b/device-types/Nokia/7220-IXR-D1.yaml @@ -7,6 +7,8 @@ u_height: 1 is_full_depth: false # 15.75" weight: 16.31 weight_unit: lb +front_image: true +rear_image: true comments: '[Datasheet](https://pf.content.nokia.com/too54x-webscale-dc-fabric-product/7220-dc-routers-data-sheet)' console-ports: - name: Console diff --git a/device-types/Nokia/7220-IXR-D2.yaml b/device-types/Nokia/7220-IXR-D2.yaml index 1a6bfa181..d20308a60 100644 --- a/device-types/Nokia/7220-IXR-D2.yaml +++ b/device-types/Nokia/7220-IXR-D2.yaml @@ -7,6 +7,8 @@ u_height: 1 is_full_depth: false # 18.11" weight: 18.08 weight_unit: lb +front_image: true +rear_image: true comments: '[Datasheet](https://pf.content.nokia.com/too54x-webscale-dc-fabric-product/7220-dc-routers-data-sheet)' console-ports: - name: Console diff --git a/device-types/Nokia/7220-IXR-D2L.yaml b/device-types/Nokia/7220-IXR-D2L.yaml index 4695c02b9..bc20c1a90 100644 --- a/device-types/Nokia/7220-IXR-D2L.yaml +++ b/device-types/Nokia/7220-IXR-D2L.yaml @@ -7,6 +7,8 @@ u_height: 1 is_full_depth: true # 21.10" weight: 22 # fully populated, 16.23 unpopulated weight_unit: lb +front_image: true +rear_image: true comments: '[Datasheet](https://pf.content.nokia.com/too54x-webscale-dc-fabric-product/7220-dc-routers-data-sheet)' console-ports: - name: Console diff --git a/device-types/Nokia/7220-IXR-D3.yaml b/device-types/Nokia/7220-IXR-D3.yaml index 4e728e86c..b3696227a 100644 --- a/device-types/Nokia/7220-IXR-D3.yaml +++ b/device-types/Nokia/7220-IXR-D3.yaml @@ -7,6 +7,8 @@ u_height: 1 is_full_depth: false # 18.11" weight: 19.20 weight_unit: lb +front_image: true +rear_image: true comments: '[Datasheet](https://pf.content.nokia.com/too54x-webscale-dc-fabric-product/7220-dc-routers-data-sheet)' console-ports: - name: Console diff --git a/device-types/Nokia/7220-IXR-D3L.yaml b/device-types/Nokia/7220-IXR-D3L.yaml index 97cba45e5..8f438ceef 100644 --- a/device-types/Nokia/7220-IXR-D3L.yaml +++ b/device-types/Nokia/7220-IXR-D3L.yaml @@ -7,6 +7,8 @@ u_height: 1 is_full_depth: true # 21.28" weight: 20.64 # fully populated, 14.66 unpopulated weight_unit: lb +front_image: true +rear_image: true comments: '[Datasheet](https://pf.content.nokia.com/too54x-webscale-dc-fabric-product/7220-dc-routers-data-sheet)' console-ports: - name: Console diff --git a/elevation-images/Nokia/nokia-7220-ixr-d1.front.png b/elevation-images/Nokia/nokia-7220-ixr-d1.front.png new file mode 100644 index 000000000..fe53ef72c Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d1.front.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d1.rear.png b/elevation-images/Nokia/nokia-7220-ixr-d1.rear.png new file mode 100644 index 000000000..18fc88872 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d1.rear.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d2.front.png b/elevation-images/Nokia/nokia-7220-ixr-d2.front.png new file mode 100644 index 000000000..c6f89c7ee Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d2.front.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d2.rear.png b/elevation-images/Nokia/nokia-7220-ixr-d2.rear.png new file mode 100644 index 000000000..f6c902b95 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d2.rear.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d2l.front.png b/elevation-images/Nokia/nokia-7220-ixr-d2l.front.png new file mode 100644 index 000000000..acc2664a2 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d2l.front.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d2l.rear.png b/elevation-images/Nokia/nokia-7220-ixr-d2l.rear.png new file mode 100644 index 000000000..ff1ca1edf Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d2l.rear.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d3.front.png b/elevation-images/Nokia/nokia-7220-ixr-d3.front.png new file mode 100644 index 000000000..b92d045e7 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d3.front.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d3.rear.png b/elevation-images/Nokia/nokia-7220-ixr-d3.rear.png new file mode 100644 index 000000000..8346ad869 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d3.rear.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d3l.front.png b/elevation-images/Nokia/nokia-7220-ixr-d3l.front.png new file mode 100644 index 000000000..e46343b00 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d3l.front.png differ diff --git a/elevation-images/Nokia/nokia-7220-ixr-d3l.rear.png b/elevation-images/Nokia/nokia-7220-ixr-d3l.rear.png new file mode 100644 index 000000000..f7962b523 Binary files /dev/null and b/elevation-images/Nokia/nokia-7220-ixr-d3l.rear.png differ diff --git a/elevation-images/Nokia/7220-IXR-H3.front.png b/elevation-images/Nokia/nokia-7220-ixr-h3.front.png similarity index 100% rename from elevation-images/Nokia/7220-IXR-H3.front.png rename to elevation-images/Nokia/nokia-7220-ixr-h3.front.png diff --git a/elevation-images/Nokia/7220-IXR-H3.rear.png b/elevation-images/Nokia/nokia-7220-ixr-h3.rear.png similarity index 100% rename from elevation-images/Nokia/7220-IXR-H3.rear.png rename to elevation-images/Nokia/nokia-7220-ixr-h3.rear.png diff --git a/tests/definitions_test.py b/tests/definitions_test.py index 83c7d659c..7a3c86a67 100644 --- a/tests/definitions_test.py +++ b/tests/definitions_test.py @@ -60,10 +60,10 @@ def _get_image_files(): ret = [] for f in sorted(glob.glob(f"elevation-images/*/*", recursive=True)): - # f = 'elevation-images/Nokia/nokia-7220-ixr-h3-front.png' + # f = 'elevation-images/Nokia/nokia-7220-ixr-h3.front.png' # f.split('/')[1] = Nokia assert f.split('/')[2].split('.')[-1] in IMAGE_FILETYPES, f"Invalid file extension: {f}" - + ret.append((f.split('/')[1], f)) return ret @@ -155,25 +155,23 @@ def test_definitions(file_path, schema): # Check for images if front_image or rear_image is True if (definition.get('front_image') or definition.get('rear_image')): - manufacturer_images = [image for image in image_files if image[0] == file_path.split('/')[1]] + # Find images for given manufacturer, with matching device slug (exact match including case) + manufacturer_images = [image[1] for image in image_files if image[0] == file_path.split('/')[1] and os.path.basename(image[1]).split('.')[0] == slug] if not manufacturer_images: - pytest.fail(f'{file_path} has Front or Rear Image set to True but no images found for manufacturer', False) + pytest.fail(f'{file_path} has Front or Rear Image set to True but no images found for manufacturer/device (slug={slug})', False) + elif len(manufacturer_images)>2: + pytest.fail(f'More than 2 images found for device with slug {slug}: {manufacturer_images}', False) if(definition.get('front_image')): - devices = [image_path.split('/')[2] for image, image_path in manufacturer_images if image_path.split('/')[2].split('.')[1] == 'front'] - - if not devices: - pytest.fail(f'{file_path} has front_image set to True but no images found for device', False) - - for device_image in devices: - assert slug.find(device_image.split('.')[0].casefold()) != -1, f'{file_path} has front_image set to True but no images found for device' + front_image = [image_path.split('/')[2] for image_path in manufacturer_images if os.path.basename(image_path).split('.')[1] == 'front'] + + if not front_image: + pytest.fail(f'{file_path} has front_image set to True but no matching image found for device ({manufacturer_images})', False) + if(definition.get('rear_image')): - devices = [image_path.split('/')[2] for image, image_path in manufacturer_images if image_path.split('/')[2].split('.')[1] == 'rear'] - - if not devices: + rear_image = [image_path.split('/')[2] for image_path in manufacturer_images if os.path.basename(image_path).split('.')[1] == 'rear'] + + if not rear_image: pytest.fail(f'{file_path} has rear_image set to True but no images found for device', False) - - for device_image in devices: - assert slug.find(device_image.split('.')[0].casefold()) != -1, f'{file_path} has rear_image set to True but no images found for device' iterdict(definition)