Merge pull request #2 from kr0sh512/refactor
change topology UML to d2 diagram
This commit is contained in:
+110
@@ -0,0 +1,110 @@
|
|||||||
|
direction: down
|
||||||
|
|
||||||
|
Topology: {
|
||||||
|
shape: class
|
||||||
|
devices: "Dict[str, Device]"
|
||||||
|
networks: "Dict[str, Network]"
|
||||||
|
__init__(self)
|
||||||
|
"add_device(self, device: Device)"
|
||||||
|
"rm_device(self, device: Device)"
|
||||||
|
"add_network(self, network: Network)"
|
||||||
|
"rm_network(self, network: Network)"
|
||||||
|
__repr__(self): str
|
||||||
|
}
|
||||||
|
|
||||||
|
Network: {
|
||||||
|
shape:class
|
||||||
|
name: str
|
||||||
|
interfaces: "List[Interface]"
|
||||||
|
vlan: "Optional[str]"
|
||||||
|
network_ip: "Optional[str]"
|
||||||
|
subnet_mask: "Optional[str]"
|
||||||
|
"__init__(self, ...)"
|
||||||
|
"add_interface(self, interface: Interface)"
|
||||||
|
"rm_interface(self, interface: Interface)"
|
||||||
|
__repr__(self): str
|
||||||
|
}
|
||||||
|
|
||||||
|
Host: {
|
||||||
|
shape: class
|
||||||
|
}
|
||||||
|
Router: {
|
||||||
|
shape: class
|
||||||
|
}
|
||||||
|
Switch: {
|
||||||
|
shape: class
|
||||||
|
}
|
||||||
|
|
||||||
|
Device: {
|
||||||
|
shape: class
|
||||||
|
|
||||||
|
name: str
|
||||||
|
role: str
|
||||||
|
interfaces: "Dict[str, Interface]"
|
||||||
|
"__init__(self, name: str)"
|
||||||
|
"add_interface(self, interface: Interface)"
|
||||||
|
"rm_interface(self, interface: Interface)"
|
||||||
|
__repr__(self): str
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtualInterface: {
|
||||||
|
shape: class
|
||||||
|
}
|
||||||
|
|
||||||
|
Interface: {
|
||||||
|
shape: class
|
||||||
|
|
||||||
|
name: str
|
||||||
|
ip_address: "Optional[str]"
|
||||||
|
network: "Optional[str]"
|
||||||
|
default_gateway: "Optional[str]"
|
||||||
|
device: Device
|
||||||
|
|
||||||
|
"__init__(self, ...)"
|
||||||
|
__repr__(self): str
|
||||||
|
}
|
||||||
|
|
||||||
|
Host -> Device: {
|
||||||
|
target-arrowhead.shape: triangle
|
||||||
|
target-arrowhead.style.filled: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Router -> Device: {
|
||||||
|
target-arrowhead.shape: triangle
|
||||||
|
target-arrowhead.style.filled: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch -> Device: {
|
||||||
|
target-arrowhead.shape: triangle
|
||||||
|
target-arrowhead.style.filled: false
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtualInterface -> Interface: {
|
||||||
|
target-arrowhead.shape: triangle
|
||||||
|
target-arrowhead.style.filled: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Device -- Interface: has {
|
||||||
|
source-arrowhead: 1..*
|
||||||
|
target-arrowhead: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Device -- VirtualInterface: has {
|
||||||
|
source-arrowhead: 1..*
|
||||||
|
target-arrowhead: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Topology -- Network: has {
|
||||||
|
source-arrowhead: 1..*
|
||||||
|
target-arrowhead: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Topology -- Device: has {
|
||||||
|
source-arrowhead: 1..*
|
||||||
|
target-arrowhead: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Network -- Interface: has {
|
||||||
|
source-arrowhead: 1..*
|
||||||
|
target-arrowhead: 1
|
||||||
|
}
|
||||||
-79
@@ -1,79 +0,0 @@
|
|||||||
@startuml
|
|
||||||
|
|
||||||
' ===========================
|
|
||||||
' Abstract base class
|
|
||||||
' ===========================
|
|
||||||
|
|
||||||
abstract class Device {
|
|
||||||
- name : String
|
|
||||||
- mgmtIP : String
|
|
||||||
- interfaces : Interface[*]
|
|
||||||
}
|
|
||||||
|
|
||||||
Device "1" o-- "0..*" Interface : has >
|
|
||||||
|
|
||||||
' ===========================
|
|
||||||
' Device Types
|
|
||||||
' ===========================
|
|
||||||
|
|
||||||
class Host {
|
|
||||||
- operatingSystem : String
|
|
||||||
}
|
|
||||||
|
|
||||||
class Router {
|
|
||||||
- routingTable : Map
|
|
||||||
- routingProtocols : List
|
|
||||||
}
|
|
||||||
|
|
||||||
class Switch {
|
|
||||||
- macTable : Map
|
|
||||||
- vlanDatabase : Map
|
|
||||||
}
|
|
||||||
|
|
||||||
Device <|-- Host
|
|
||||||
Device <|-- Router
|
|
||||||
Device <|-- Switch
|
|
||||||
|
|
||||||
' ===========================
|
|
||||||
' Interfaces
|
|
||||||
' ===========================
|
|
||||||
|
|
||||||
class Interface {
|
|
||||||
- name : String
|
|
||||||
- ipAddress : String
|
|
||||||
- macAddress : String
|
|
||||||
- speed : String
|
|
||||||
- duplex : String
|
|
||||||
}
|
|
||||||
|
|
||||||
class VirtualInterface {
|
|
||||||
- vlanId : Integer
|
|
||||||
- parentPhysical : Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
Interface <|-- VirtualInterface
|
|
||||||
|
|
||||||
' ===========================
|
|
||||||
' Physical Links
|
|
||||||
' ===========================
|
|
||||||
|
|
||||||
class Wire {
|
|
||||||
- type : String
|
|
||||||
- endpoints : Interface[2]
|
|
||||||
- bandwidth : String
|
|
||||||
}
|
|
||||||
|
|
||||||
Wire "1" -- "2" Interface : connects >
|
|
||||||
|
|
||||||
' ===========================
|
|
||||||
' Optional: Networks / Subnets
|
|
||||||
' ===========================
|
|
||||||
|
|
||||||
class Network {
|
|
||||||
- cidr : String
|
|
||||||
- gateway : String
|
|
||||||
}
|
|
||||||
|
|
||||||
Network "1" o-- "0..*" Interface : membership >
|
|
||||||
|
|
||||||
@enduml
|
|
||||||
Reference in New Issue
Block a user