[SOLVED] Database - Database model

35.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

Prerequisites:

Python 3.6+

PostgreSQL 10+

 

Database model:

id SERIAL PRIMARY KEY,

connection INTEGER,

name VARCHAR(255) NOT NULL,

description VARCHAR(255),

config json,

type VARCHAR(50),

infra_type VARCHAR(50),

port_channel_id INTEGER,

max_frame_size INTEGER

 

Description:

You  need to extract device interface configuration from config.json file and store relevant data to database. There are 10 BDI, 1 Loopback, 2 Port-channel, 4 TenGigabitEthernet and 3 GigabitEthernet interfaces.

We are interested only on Port-channels and Ethernet interfaces. BDI and Loopback can be ignored for now, but you solution should be able to handle BDI and Loopback in future.

In database we want to fill this fields, other can be null:

id

name

  • interface group name + interface name, for example “TenGigabitEthernet0/0/5”

description

  • optional, interface description, for example “member of Portchannel20”

max_frame_size

  • optional, mtu from interface configuration

config

  • whole interface configuration

port_channel_id

  • link Ethernet interfaces to Port-channel. This is defined in configuration by:

“Cisco-IOS-XE-ethernet:channel-group”: {

“number”: 20,

“mode”: “active”

}

Sample result:

At the end, there should be 9 rows in interface table. For example, Portchannel20 and  TenGigabitEthernet0/0/5 should look like

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.