Skip to content
Snippets Groups Projects
Commit a4fd6b69 authored by Barta Máté Zsombor's avatar Barta Máté Zsombor :speech_balloon:
Browse files

eee

parent 59e3179d
No related branches found
No related tags found
No related merge requests found
192.168.6.2
\ No newline at end of file
192.168.2.2
\ No newline at end of file
router5
\ No newline at end of file
router3
\ No newline at end of file
......@@ -38,7 +38,7 @@ def read():
newitem = Host()
os.system('ansible-playbook playbooks/get_informations.yaml -i inventory/hosts.yaml --ask-pass')
#os.system('ansible-playbook playbooks/get_informations.yaml -i inventory/hosts.yaml --ask-pass')
routersNumber = int(input("Adja meg hany router van a halozatban (szammal): "))
......@@ -129,22 +129,6 @@ def checkroutings():
for j in i:
for x in hosts:
if j == x.name:
for pindex, p in enumerate(x.networks):
if searchedNetwork == p:
if searchedMask != x.masks[pindex]:
p = open("host.txt", "w")
p.write(x.name)
f = open("repairmask.txt", "w")
f.write(searchedMask)
g = open("repairip.txt", "w")
g.write(searchedNetwork)
for k in x.networks:
for index, h in enumerate(elozo.networks):
if h == k:
h = open("dest.txt", "w")
h.write(elozo.ips[index])
#print(elozo.ips[index])
for pindex, p in enumerate(x.sroutes):
if searchedNetwork == p:
if searchedMask != x.smasks[pindex]:
......@@ -160,8 +144,14 @@ def checkroutings():
if h == k:
h = open("dest.txt", "w")
h.write(elozo.ips[index])
#print(elozo.ips[index])
print(elozo.name)
repairtables()
if searchedMask < x.smasks[pindex]:
print(searchedMask + " " + x.smasks[pindex])
l = open("oldmask.txt", "w")
ipmask = ipaddress.IPv4Network((0, x.smasks[pindex]))
l.write(str(ipmask.netmask))
delete()
print(elozo.name + " " + j)
elozo = getelement(j)
def getelement(element):
......@@ -169,8 +159,12 @@ def getelement(element):
if i.name == element:
return i
def delete():
#os.system('ansible-playbook playbooks/delete_routing.yaml -i inventory/hosts.yaml --ask-pass')
print("deleted")
def repairtables():
os.system('ansible-playbook playbooks/repair_routing.yaml -i inventory/hosts.yaml --ask-pass')
#os.system('ansible-playbook playbooks/repair_routing.yaml -i inventory/hosts.yaml --ask-pass')
print("routing javitva")
def draw():
......@@ -186,7 +180,6 @@ def main():
graphConstruct()
findpath()
checkroutings()
repairtables()
draw()
clear()
......
255.255.255.192
\ No newline at end of file
---
- name: Repair routing mask
hosts: "{{ lookup('file', '~/onlab/host.txt') }}"
gather_facts: false
connection: network_cli
tasks:
- name: Mask repair
cisco.ios.ios_command:
commands:
- configure terminal
- ip route {{ lookup('file', '~/onlab/repairip.txt') }} {{ lookup('file', '~/onlab/oldmask.txt' ) }} {{ lookup('file', '~/onlab/dest.txt') }}
\ No newline at end of file
......@@ -13,7 +13,7 @@ Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.1.0/24 is directly connected, GigabitEthernet1/0/43
L 10.10.1.6/32 is directly connected, GigabitEthernet1/0/43
S 192.168.2.0/23 [1/0] via 192.168.6.2
S 192.168.2.0/26 [1/0] via 192.168.6.2
192.168.6.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.6.0/24 is directly connected, GigabitEthernet1/0/1
L 192.168.6.1/32 is directly connected, GigabitEthernet1/0/1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment