حتى في شبكة جيدة ، من وجهة نظر التصميم ، من الضروري من وقت لآخر القيام بعمل على تحديث تكوينات كيانات معينة. من بين الأسباب الأكثر إلحاحًا وتوقعًا لمثل هذا النشاط ، يمكن ملاحظة الهجرة لتنسيق الطائرات المادية والمنطقية ، وتطوير الشبكة كجزء من عملية التطور التكنولوجي ، ومواءمة بنية الأجزاء المتصلة وحل مشاكل النمو. في الواقع ، تتكون دورة حياة الشبكة دائمًا تقريبًا من تغيرات بمستوى واحد أو آخر من المخاطر وتأثير مقسم على الخدمة ، في تقييم لا يمكن تجاهل العامل البشري. على الرغم من أنه سيكون من المناسب تمامًا تعميم هذا الوصف على معظم مجالات النشاط البشري ، إلا أن عمل شبكات الاتصال لديه بعض الميزات التي تستحق الفهم ، أو على الأقل الاهتمام - عناصر شبكات الاتصال في اتصال ضيق ، وتتفاعل بشكل وثيق ولا تقدم مباشرة ، ولكن أيضًا غير مباشرة تأثير على بعضهم البعض. لذلك ، ستصبح الاستراتيجية المختصة للعمل الجاري أكثر إنتاجية فقط إذا كانت مدعومة بآليات تقلل ، قدر الإمكان ، من احتمال وقوع أخطاء بشرية. في المقالة التالية من سلسلة
"لماذا يجب على برنامج مهندسي الشبكات" ، سأتحدث عن خيارات استخدام الأتمتة في مهمة واحدة من هذا النوع.
في العديد من "البادئات" حول بنية الشبكة ، يتم استخدام مصطلحات الشبكات واسعة النطاق والشبكات الهرمية بشكل مترادف تقريبًا ، فيما يتعلق بتصميم مجال IGP ، يشار إلى تصميم بسيط ومفهوم للوهلة الأولى - تقسيم المجال إلى المجالات. في نفس الوقت ، عتبة التشبع هي شيء فردي بحت ، في بعض الحالات ، يمكن أن تتعايش ألف جهاز توجيه حديثة عادة في منطقة IGP واحدة ، وإلا فإن ثلاثمائة كافية لتقليل الخصائص التشغيلية بشكل كبير. بالنسبة للجزء الأكبر ، يتم تحديد هذه العتبة من خلال البروتوكولات المفروضة على IGP ، وبالتالي ، في ظروف بعض التباين وعدم اليقين لحدود ومقاييس الشبكة المستقبلية ، يجد "البيسون" في الصناعة طريقة أكثر مرونة لبناء مجال مسطح مع الترحيل اللاحق لأجزائه المشكلة إلى مناطق منفصلة. بعبارة أخرى ، إذا كنت لا تستطيع "النظر غدًا" ، فقم ببناء شبكة مسطحة وتقسيمها عند ظهور العلامات الأولى لتدهور وقت التقارب أو تعقيد الاستغلال المفرط ، لأن غياب التسلسل الهرمي لا يزال أفضل من الخطأ الذي تم اختياره في ظل عدم اليقين هيكل [1 ، 2 ، 3].
الأوصاف العامة والأمثلة المجردة ، لنفترض أننا نتعامل مع منطقة متضخمة من مجال OSPFv2 ، طوبولوجيا الألياف / القنوات المادية التي تجعل بالفعل من الممكن تمييز حدود المناطق المستقبلية في البنية غير المتبلورة. أنا لست مؤيدًا لتغيير شيء ما على مبدأ "كل شيء أو لا شيء" ، قد يحدث أنه بسبب الظروف غير المتوقعة ستصبح مساحة الفرص ضيقة جدًا ، والمخاطر المتوقعة كبيرة جدًا. يعد تغيير منطقة OSPFv2 عملية مدمرة ، وبالتالي فإن المخطط الأكثر مباشرة لعملية الترحيل ، والذي يتكون من نقل أجهزة التوجيه بشكل متسلسل إلى منطقة جديدة على طول الطريق من الحد المستقبلي لأسفل ، يكون مناسبًا في جميع الهياكل. لحسن الحظ ، في وقت ما ، في توصيات لتطوير OSPF ، تم تحديد إمكانية بناء الاتصال في العديد من المجالات [4]. باستخدام هذه الفرصة ، يمكننا تقسيم الهجرة إلى ثلاث مراحل:
- بناء توصيلية إضافية (ثانوية) في منطقة جديدة
- نقل منطقة جديدة إلى الوضع الرئيسي ، والقديمة إلى إضافية
- إزالة الاتصال ضمن النطاق القديم
في المرحلة الأولى ، تتوسع طوبولوجيا المنطقة الجديدة تدريجيًا ؛ وفي المرحلة الثانية ، تتقلص طوبولوجيا المنطقة القديمة. وفقًا لتطابق طوبولوجيا المناطق القديمة والجديدة ، نحصل على توجيه ثابت بين العقد المترجمة وغير المترجمة ، وهذا بدوره يجعل من الممكن تقسيم المراحل إلى مراحل فرعية مستقلة ، يمكن في كل منها العمل مع جزء من العقد. من المستحسن الاقتراب من اختيار عقد العمل في إطار المرحلة الفرعية من وجهة نظر الاستخدام الفعلي للقنوات في شبكة معينة بطريقة تمنع إعادة التحميل على حدود المناطق القديمة والجديدة. على الرغم من حقيقة أن المقالة مخصصة للبرمجة ، أعتقد أنه لن يكون من غير الضروري أن نقول بضع كلمات حول سلوك البروتوكولات المفروضة على IGP في سياق المجالات المتغيرة. يتصرف LDP بشكل يمكن توقعه تمامًا ؛ يتم تحقيق الترجمة السلسة من خلال توفير اتصال IP بين جلسات استهداف عنوان النقل وجلسات الواجهة. نظرًا لحقيقة أن BGP هو بروتوكول مرن جدًا ، يجب عليك الانتباه جيدًا لهذه الطائرة. من الجيد إذا لم تقدم BGP حريات خاصة على العقد المترجمة في شكل تغييرات في التفضيلات المحلية أو معايير أخرى تحدد قرار التوجيه المحلي غير المتسق بين العقد. وبعبارة أخرى ، يمكن توقع سلوك BGP أيضًا إذا لم يتعارض اختيار المسار داخل المنطقة مع قاعدة مسار IGP التالية. هناك نقطة خفية مرتبطة بعمل RSVP خلال الفترة الزمنية للتعايش بين منطقتين. إن حقيقة ملء جدول TED من مصدرين برؤية مختلفة تثير بعض الأسباب للتفكير ، على سبيل المثال ، قد تفقد آليات FRR حتى اكتمال العمل. يمكن أن يحدث هذا إذا قامت أجهزة التوجيه ذات الرؤية الأعلى ، الموجودة في منطقتين ، بحساب ERO من خلال جهاز توجيه ذي رؤية أقل ، أي من خلال قطعة شبكة مترجمة بدون معلومات طوبوغرافية عن منطقة أخرى. لا يمكن أن يسمى هذا كارثة ، حيث سيتم تحديد المسار في نهاية المطاف ، ولكن يجب ألا تنسى ذلك. يتطلب الفن الخاص الجمع بين عمل إدخال التسلسلات الهرمية IGP مع نفس النوع من العمل في مستوى BGP ، على سبيل المثال ، من خلال ترحيل الشبكة الكاملة إلى عاكسات المسار. من الأفضل تنفيذ التسلسل الهرمي في الطائرات المختلفة بالتسلسل ، وينطبق الشيء نفسه ، في رأيي ، على جميع الأشياء التي تخفي معلومات التوجيه ، من الأسهل البناء على أساس ثابت من IGP الهرمي من الجمع بين هذه المراحل.
لذا ، لدينا خطة عامة ، وإذا لم تغير رأيك بعد ، دعنا نفكر في تنفيذ برنامج على Pyez ، شيء من هذا القبيل في الصورة.

يمكن أن يكون كل شكل بيضاوي جميل كيان برمجيات منفصل ، أي الشيء الذي يقوم بالعمل ويجهز البيانات للخطوة التالية. البيانات الأولية تعني معلومات من الشبكة ، على سبيل المثال ، من أجل إعداد تكوين منطقة OSPF جديدة ، تحتاج إلى الحصول على أسماء الواجهات النشطة التي تنتمي إلى المنطقة القديمة ووزنها ، مما يعني أننا سنحتاج إلى مهارات في العمل مع جداول التشغيل وطرق العرض. يمكن العثور على هذه المفاهيم في مقال سابق في سلسلة
"البرمجة لمهندسي الشبكات: الحالة الأولى" . في المرحلة الأولى ، يحفظ المولد في الملفات الأوامر اللازمة لتنشيط المنطقة الجديدة ، في الثانية - لحذف القديم ونقل الجديد إلى الوضع الرئيسي ، في الثالث - الأمر بحذف المنطقة القديمة. في المستقبل ، سأقول أنه بالنسبة لهذه المقالة ، لا أستخدم عن قصد متخيلات القالب مثل Jinja2. لكي لا يتم تشتيت انتباهك عن الموضوع المستهدف ، تتم كتابة الرمز بأبسط ما يمكن. إذا كان شخص ما مهتمًا بالوثائق الموجودة على الرابط
"Jinja2 Documentation" .
رمز إنشاء تكوين الخطوةimport sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) return def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) yml = ''' --- OSPFInterface: rpc: get-ospf-interface-information args: area: '0.0.0.200' detail: True item: ospf-interface view: OSPFInterfaceView OSPFInterfaceView: fields: name: interface-name type: interface-type cost: interface-cost ''' globals().update(FactoryLoader().load(yaml.load(yml))) node_list = ['10.83.20.68', '10.83.20.69', '10.83.20.70', '10.83.20.71'] abr_list = ['10.83.20.66', '10.83.20.67'] for node in node_list + abr_list: ddev = getConnection(node, 'lab') ospf_interfaces = OSPFInterface(ddev).get() with open('st1-' + node + '.txt', "w") as f_st1: for ospf_interface in ospf_interfaces: if ( 'ge' in ospf_interface.name ): f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' secondary' + '\n') f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') with open('st2-' + node + '.txt', "w") as f_st1: f_st1.write('delete protocols ospf area 0.0.0.200' + '\n') f_st1.write('delete protocols ospf area 0.0.0.250' + '\n') for ospf_interface in ospf_interfaces: f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' secondary' + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') if (ospf_interface.cost != '0'): f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') with open('st3-' + node + '.txt', "w") as f_st1: f_st1.write('delete protocols ospf area 0.0.0.200' + '\n')
من أجل الوضوح ، جمعت في مثل هذه الشبكة على vMX.

vMX هو موجه برامج كامل المواصفات من Juniper Networks ، يكرر إلى حد كبير سلوك أخيها الحديدي MX الأكبر. ليس لأنه كان منتجًا يجب تقديمه ، من المفيد فقط إبقاء هذه الأشياء في متناول يدك لتمارين البرمجة أو الاختبارات المعملية. يمكن تنزيل
النسخة التجريبية هنا
"vMX Trial Download" ، وتعليمات التثبيت على هذا الرابط
"تحضير النظام لتثبيت vMX" .
الموجهات bb و abr1 و abr2 من منطقة الصفر ، يجب نقل أجهزة التوجيه r1 و r2 و r3 و r4 من المنطقة 200 إلى 250.
lab @ bb> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/3.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } } }
lab @ abr1> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.66; neighbor 10.0.0.65; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface ge-0/0/0.0 { interface-type p2p; } } area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } } }
lab @ abr2> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.67; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { interface-type p2p; } interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } } area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } } }
lab @ r1> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.68; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } }
lab @ r2> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.69; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } }
lab @ r3> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.70; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } }
lab @ r4> إظهار بروتوكولات التكوين bgp { group int { type internal; local-address 10.0.0.71; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; } } ospf { area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } }
بالنسبة إلى جهاز التوجيه r2 ، سيتم إنشاء مجموعة الأوامر التالية.
للمرحلة الأولىتعيين البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 1.0 الثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 1.0 نوع واجهة p2p
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 1.0 بالمقياس 1
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 2.0 الثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 2.0 نوع واجهة p2p
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 2.0 المتري 1
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 3.0 الثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 3.0 نوع واجهة p2p
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 3.0 متري 1
للمرحلة الثانيةحذف البروتوكولات منطقة ospf 0.0.0.200
حذف البروتوكولات منطقة ospf 0.0.0.250
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 1.0 نوع واجهة p2p
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 1.0 ثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 1.0 نوع واجهة p2p
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 1.0 بالمقياس 1
تعيين البروتوكولات ospf area 0.0.0.200 واجهة ge-0/0 / 1.0 متري 1
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 2.0 نوع واجهة p2p
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 2.0 ثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 2.0 نوع واجهة p2p
ضبط البروتوكولات ospf area 0.0.0.250 الواجهة ge-0/0 / 2.0 المتري 1
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 2.0 متري 1
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 3.0 نوع واجهة p2p
ضبط البروتوكولات ospf area 0.0.0.200 الواجهة ge-0/0 / 3.0 الثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 3.0 نوع واجهة p2p
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة ge-0/0 / 3.0 متري 1
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة ge-0/0 / 3.0 متري 1
تعيين البروتوكولات منطقة ospf 0.0.0.250 واجهة lo0.0 نوع واجهة p2p
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة lo0.0 ثانوية
تعيين البروتوكولات منطقة ospf 0.0.0.200 واجهة lo0.0 نوع واجهة p2p
للمرحلة الثالثةحذف البروتوكولات منطقة ospf 0.0.0.200
كما كتبت بالفعل ، فإن عناصر الشبكة لها حالة داخلية ، حولها وداخلها شيء يحدث باستمرار بغض النظر عما إذا كنا نريد ذلك أم لا. يجب أن يؤخذ وقوع أحداث مثل فشل جهاز الإرسال / الاستقبال ، أو انقطاع التيار الكهربائي في العقدة ، أو انقطاع في قناة بصرية كأمر مسلم به وأن يؤخذ في الاعتبار أثناء العمل. أقترح الانتباه إلى هذه الحقيقة في سياق اختيار التحقق من نجاح مراحل الهجرة. بغض النظر عن مدى التناقض الذي قد يبدو عليه هذا ، في هذه الحالة ليس من الضروري بالنسبة لنا التحقق مما إذا كان حي OSPF ظهر على هذه الواجهة أو تلك الواجهة ، نظرًا لأن أسباب غيابه يمكن أن تكون في مستوى مختلف تمامًا. بالإضافة إلى ما سبق ، يمكن أن يحدث خطأ أو عدم دقة في البيانات المصدر دائمًا ، على سبيل المثال ، على سبيل المثال ، في شكل واجهة منسية يجب حذفها ، ولكنها تبحث حاليًا في "الفراغ". في عملية توليد الشيكات ، من المفيد الصعود إلى مستوى واحد للنظر إلى الشبكة من وجهة نظر الخدمات المقدمة والبروتوكولات المفروضة ، لأن حالة هذه الأشياء فقط تسمح لك في نهاية المطاف باتخاذ قرار مستنير بشأن نجاح مرحلة معينة. يوافق عدد قليل من العملاء على المقالات العامة بناءً على نتائج عملهم ، ولهذا السبب قمت بتجميع بيئة افتراضية للعرض. في هذه البيئة ، سوف أقصر نفسي على التحقق من حالة جلسات BGP ، والتي يتم إنشاؤها على أساس واحد لواحد بين أجهزة التوجيه ، ستكون هذه الخدمات والخدمات التي نفرضها. إذا تم استيفاء شروط أدائهم ، بعد العمل ، في شكل اتصال IP مع كل منهما ، فهناك سبب للاعتقاد بأن العمل قد تم بنجاح. في المشاريع الحقيقية ، تقتصر عمليات الفحص عادةً على حجم الخدمات والبروتوكولات المفروضة ، والتي تم تصنيفها على أنها مهمة للأعمال في شبكة معينة. هذا لا ينطبق على البرمجة ، ومع ذلك ، لا يسعني إلا أن أركز على هذه المشكلة ، لأن اختيار معيار النجاح هو مفتاح النوم الجيد بعد العمل المنجز.
كود التحقق من جلسة BGP import sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) return def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) ip_f_name = 'ip-list-1.txt' yml = ''' --- BGPGroup: rpc: get-bgp-group-information args: group-name: 'int' item: bgp-group view: BGPGroupView BGPGroupView: fields: count: peer-count established: established-count ''' globals().update(FactoryLoader().load(yaml.load(yml))) node_list = ['10.83.20.68', '10.83.20.69', '10.83.20.70', '10.83.20.71'] abr_list = ['10.83.20.66', '10.83.20.67'] for node in node_list + abr_list: ddev = getConnection(node, 'lab') bgp_group = BGPGroup(ddev).get() for group in bgp_group: if (group.count != group.established): print 'bgp connection lost' else: print 'dont panic!'
نتائج عملهDEBUG - الحصول على اتصال ssh إلى 10.83.20.68
DEBUG - إنشاء اتصال ssh لاستضافة 10.83.20.68
DEBUG - تم إنشاء اتصال 10.83.20.68 المسمى r1
لا داعي للذعر!
DEBUG - الحصول على اتصال ssh إلى 10.83.20.69
DEBUG - إنشاء اتصال ssh لاستضافة 10.83.20.69
DEBUG - تم إنشاء اتصال 10.83.20.69 المسمى r2
لا داعي للذعر!
DEBUG - الحصول على اتصال ssh إلى 10.83.20.70
DEBUG - إنشاء اتصال ssh لاستضافة 10.83.20.70
DEBUG - تم إنشاء اتصال 10.83.20.70 المسمى r3
لا داعي للذعر!
DEBUG - الحصول على اتصال ssh إلى 10.83.20.71
DEBUG - إنشاء اتصال ssh لاستضافة 10.83.20.71
DEBUG - تم إنشاء اتصال 10.83.20.71 المسمى r4
لا داعي للذعر!
DEBUG - الحصول على اتصال ssh إلى 10.83.20.66
DEBUG - إنشاء اتصال ssh لاستضافة 10.83.20.66
DEBUG - تم إنشاء اتصال 10.83.20.66 باسم abr1
لا داعي للذعر!
DEBUG - الحصول على اتصال ssh إلى 10.83.20.67
DEBUG - تأسيس اتصال ssh لاستضافة 10.83.20.67
DEBUG - تم إنشاء اتصال 10.83.20.67 باسم abr2
لا داعي للذعر!
حتى الآن ، تحدثنا في الغالب عن نوع من أشياء الشبكة ، ولكن ما زلت لم أقل كلمة واحدة عن رمز البرنامج ، والتي يبدو أنها مركز الاهتمام في مقال بهذا الاسم. أولاً ، يبدو لي أن الأفكار أكثر أهمية بكثير من التعليمات البرمجية ، حيث أن الكيانات ذات الطابع الرسمي في الرأس ، يمكن للمهندس تحويلها إلى أداة وتحديدها في شكل رمز. ثانيًا ، لا أريد أن أكرر نفسي ، كل شيء قد لا يبدو واضحًا في هذه الأمثلة ، بالإضافة إلى الحد الأدنى من المعرفة اللازمة لبدء العمل مع Python و Pyez ، موجود في المقالة السابقة في السلسلة. ثالثًا ، ينفذ رمز إعداد التهيئة عمله ، والذي يُسمى بلا اتصال بالإنترنت وليس له تأثير فوري على الشبكة ، لذلك من غير المحتمل أن يسبب أي اهتمام. تختلف الأمور إلى حد ما مع رمز تنفيذ مرحلة التنفيذ ؛ يطرح تطوير هذه الإجراءات الأسئلة التالية:
- كيفية التحقق من أن الحجم الكامل للأوامر يدرك بشكل كاف من قبل المترجم
- كيفية التحقق من تطبيق التغييرات التي تم إجراؤها على التكوين؟
- كيفية تنفيذ مخطط تكوين المعاملات؟
- كيفية التراجع عن التكوين في حالة فقدان السيطرة؟
- كيفية التنظيف إذا أبلغ المترجم عن خطأ أثناء نقل الأوامر؟
كلما زاد الاهتمام بهذه القضايا ، قلما يتم تقديم المفاجآت في مرحلة التنفيذ. تخيل متاعب خطأ في بناء الجملة يصف سياسة التوجيه عندما يتم اعتماد المصنفين لهذه السياسة بشكل جزئي فقط من قبل المترجم. إذا كنت لا تتحكم بسطر في عملية دمج هذه السياسة مع التكوين الحالي ، يمكنك وضع كومة المعدات في حالة غير كافية بنقرة زر واحدة. لذلك ، ألتزم تقريبًا بمثل هذه الكتلة من مخطط مرحلة التنفيذ.

مسلحًا بوثائق
Pyez ، تم تجميع كود محمل التكوين العام التالي ، والذي يمكنك استخدامه في عملك اليومي ، تمامًا كما أستخدمه في المنجم.
conf_change.py import sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device from jnpr.junos.utils.config import Config import copy import re import traceback import time import random from jnpr.junos.exception import * import os.path yml = ''' --- VersionInfo: rpc: get-software-information item: software-information view: VersionInfoView VersionInfoView: fields: name: host-name ''' Device.auto_probe = 3 ip_f_name = 'ip-list-1.txt' cur_stage='2' globals().update(FactoryLoader().load(yaml.load(yml))) def doTestOSPF(p_dev, p_node, f_do): print ' DEBUG --- doTestOSPF : at ' + p_node if ( p_dev == None ): print ' DEBUG --- ERROR --- doTestOSPF : connection to ' + p_node + ' is None' return else: try: d_conf = p_dev.cli("show configuration | display set").split('\n') ret_val = True set_found = 0 c_path = 'st' + cur_stage + '-' + p_node + '.txt' with open(c_path, "r") as f: for line in f: c_line = line.replace('\n', '').replace('\r\n', '') if ('delete ' not in c_line): set_found = 1 if ( (c_line not in d_conf) and (c_line != '')): print ' DEBUG --- doTestOSPF found missing line ' + c_line ret_val = False f.close() if ( (set_found == 0) and (f_do == True) ): return False return ret_val except Exception as ex: print ' DEBUG --- ERROR --- doTestOSPF : connection to ' + p_node + ' was not established. ex:' + str(ex) return def doTest(p_dev, p_node, f_do): return doTestOSPF(p_dev, p_node, f_do) def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' v = VersionInfo(l_dev).get() print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) traceback.print_exc() return def doCompare(p_conf, p_node): try: print ' DEBUG --- doCompare at ' + p_node if ( p_conf.diff() == None ): return False else: return True except Exception as ex: print ' DEBUG --- ERROR --- doCompare : conf.diff at ' + p_node + ' ex:' + str(ex) return def doLoad(p_conf, p_node): try: print ' DEBUG --- doLoad at ' + p_node c_path = 'st' + cur_stage + '-' + p_node + '.txt' if (os.path.isfile(c_path)): p_conf.load(path=c_path, format='set') return True except Exception as ex: print ' DEBUG --- ERROR --- doLoad : cant load config to ' + p_node + ' ex:' + str(ex) return def doRollback(p_conf, p_node, p_r): try: print ' DEBUG --- doRollback at ' + p_node if ( p_conf.rollback(rb_id=p_r) == True ): return True else: return False except Exception as ex: print ' DEBUG --- ERROR --- doRollback : cant rollback config to ' + p_node + ' ex:' + str(ex) return None def doCommitCheck(p_conf, p_node): try: print ' DEBUG --- doCommitCheck at ' + p_node p_conf.commit_check() return True except Exception as ex: print ' DEBUG --- ERROR --- doCommitCheck : cant config commit check config to ' + p_node + ' ex:' + str(ex) return None def doCommit(p_conf, p_node, p_confirm_m=None): try: print ' DEBUG --- doCommit at ' + p_node commit_res = None if (p_confirm_m == None): commit_res = p_conf.commit(timeout=30) else: commit_res = p_conf.commit(confirm=p_confirm_m, timeout=30) if (commit_res == True): return True else: return False except CommitError as c_ex: print ' DEBUG --- ERROR --- doCommit : cant config commit at ' + p_node + ' ex:' + str(c_ex) return None except RpcTimeoutError as t_ex: print ' DEBUG --- ERROR --- doCommit : config was commited at ' + p_node + ' with the following ex:' + str(t_ex) return True def doJob(p_dev, p_node): print ' DEBUG --- doJob at ' + p_node if ( p_dev == None ): print ' DEBUG --- ERROR --- doJob : connection to ' + p_node + ' is None' return else: try: with Config(p_dev) as conf: is_compare = doCompare(conf, node) if ( is_compare == None ): print ' DEBUG --- ERROR --- doJob : at config compare ' + node return if ( is_compare == True ): print ' DEBUG --- ERROR --- doJob : configuration locked at ' + node return False print ' DEBUG --- starting to do config changes at ' + node if ( doLoad(conf, node) != True ): print ' DEBUG --- ERROR --- doJob : conf.load ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after load at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return print ' DEBUG --- commit check at ' + node if (doCommitCheck(conf, node) != True): print ' DEBUG --- ERROR --- doJob : conf.doCommitCheck failed at ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after load at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return commit_m = 5 print ' DEBUG --- commiting changes at ' + node if (doCommit(conf, node, commit_m) != True): print ' DEBUG --- ERROR --- doJob : conf.commit ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after commit at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return True except Exception as ex: print ' DEBUG --- ERROR --- doJob : cant do job ' + node + ' ex:' + str(ex) return node_list = [] result_list = {} with open(ip_f_name, "r") as f_ip: for line in f_ip: c_ip_line = line.replace('\n', '').replace('\r\n', '') if (c_ip_line != ''): node_list.append(c_ip_line) for node in node_list: print 'FLOW -- ************************************ ' print 'FLOW -- checking ' + node result_list.setdefault(node, {}) cur_dev = getConnection(node, 'lab') is_test = doTest(cur_dev, node, True) if( is_test == None): print 'FLOW -- error' result_list.setdefault(node, {}).setdefault('status', 'error') break if( is_test == True): print 'FLOW -- conf exist' result_list.setdefault(node, {}).setdefault('status', 'nn') if( is_test == False): print 'FLOW -- conf not exist, doing change' is_job = doJob(cur_dev, node) if( is_job == None): print 'FLOW -- cant do job at ' + node result_list.setdefault(node, {}).setdefault('status', 'error') break if( is_job == False): print 'FLOW -- cant do job at ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') if( is_job == True): print 'FLOW -- done job at ' + node print 'FLOW -- going sleep at ' + node time.sleep(5) print 'FLOW -- checking job status ' + node cur_dev_confirm = getConnection(node, 'lab') if ( cur_dev_confirm != None ): if (doTest(cur_dev, node, False) == True): print 'FLOW -- commiting the configuration at ' + node if (doCommit(Config(cur_dev_confirm), node) != True): print 'FLOW -- ERROR cant commit the configuration at ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') break else: print 'FLOW -- configuration commited at ' + node result_list.setdefault(node, {}).setdefault('status', 'done') else: print 'FLOW -- ERROR cant find conf after job ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') close_dev(cur_dev_confirm) else: print 'FLOW -- ERROR cant access ' + node + ' for commiting' result_list.setdefault(node, {}).setdefault('status', 'not_done') close_dev(cur_dev) print result_list
ونتائج عمله على ثلاث مراحل
نص مخفيPython 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>
>>>
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>
- بروتوكول التوجيه IS-IS الكامل - Hannes Gredler ، Walter Goralski
- OSPF تشريح بروتوكول توجيه الإنترنت - John T. Moy
- عمليات دمج الشبكات وعمليات الترحيل: تصميم وتنفيذ Junos - Gonzalo Gomez Herrero ، Jan Anton Bernal Van Der Ven
- OSPF Adjacency متعدد المناطق - tools.ietf.org/html/rfc5185