Browse Source

converting junos to network_cli

Change-Id: I9f71be4d5f63d923c30c918a7bf6b46d2757a749
Dan Radez 4 months ago
parent
commit
c50b68b594

+ 0
- 2
etc/ansible/roles/openstack-ml2/README.md View File

@@ -9,8 +9,6 @@ Requirements
9 9
 Role Variables
10 10
 --------------
11 11
 
12
-* junos_enable_netconf
13
-
14 12
 * ml2_segmenation_id
15 13
 * ml2_segmentation_name (default depends on provider)
16 14
 

+ 0
- 7
etc/ansible/roles/openstack-ml2/defaults/main.yml View File

@@ -1,11 +1,4 @@
1 1
 ---
2
-# defaults file for openstack-ml2
3
-#
4
-
5
-# enable or disable the check for netconf on a junos device.
6
-#
7
-ml2_settings_junos_enable_netconf: "{{ junos_enable_netconf }}"
8
-
9 2
 # params to implement ml2 port resource
10 3
 #
11 4
 ml2_port_name: "{{ port_name }}"

+ 7
- 2
etc/ansible/roles/openstack-ml2/providers/junos/create_vlan.yaml View File

@@ -1,3 +1,8 @@
1 1
 ---
2
-- name: "junos: run create vlan using netconf"
3
-  include_tasks: netconf.yaml
2
+- name: "junos: run create vlan using network_cli"
3
+  junos_command:
4
+    commands:
5
+      - config
6
+      - "set vlans {{ ml2_segmentation_name }} vlan-id {{ ml2_segmentation_id }}"
7
+      - commit
8
+  connection: network_cli

+ 7
- 3
etc/ansible/roles/openstack-ml2/providers/junos/delete_port.yaml View File

@@ -1,4 +1,8 @@
1 1
 ---
2
-- name: "junos: run delete_port using netconf"
3
-  include_tasks: netconf.yaml
4
-
2
+- name: "junos: run delete_port using network_cli"
3
+  junos_command:
4
+    commands:
5
+      - config
6
+      - "delete interfaces {{ ml2_port_name }}"
7
+      - commit
8
+  connection: network_cli

+ 7
- 3
etc/ansible/roles/openstack-ml2/providers/junos/delete_vlan.yaml View File

@@ -1,4 +1,8 @@
1 1
 ---
2
-- name: "junos: run delete vlan using netconf"
3
-  include_tasks: netconf.yaml
4
-
2
+- name: "junos: run delete vlan using network_cli"
3
+  junos_command:
4
+    commands:
5
+      - config
6
+      - "delete vlans {{ ml2_segmentation_name }}"
7
+      - commit
8
+  connection: network_cli

+ 0
- 31
etc/ansible/roles/openstack-ml2/providers/junos/netconf.yaml View File

@@ -1,31 +0,0 @@
1
----
2
-- name: "junos: check netconf service"
3
-  block:
4
-    - name: "junos: enable netconf if not already enabled"
5
-      junos_netconf:
6
-        state: present
7
-
8
-    - name: "junos: close network_cli connection as its no longer needed"
9
-      meta: reset_connection
10
-
11
-  connection: network_cli
12
-  # This will affect us in Ansible 2.5.6+
13
-  # Ansible bug from this pull
14
-  # https://github.com/ansible/ansible/pull/41655/files
15
-  # submitted bug report
16
-  # https://github.com/ansible/ansible/issues/46275
17
-  # commenting this conditional so we don't stacktrace
18
-  # when: ml2_settings_junos_enable_netconf
19
-
20
-- name: "junos: set netconf template"
21
-  set_fact:
22
-    ml2_junos_netconf_template: "templates/junos/{{ network_action }}.xml.j2"
23
-
24
-- name: "junos: send configuration to device"
25
-  netconf_config:
26
-    xml: "{{ lookup('template', ml2_junos_netconf_template) }}"
27
-  connection: netconf
28
-  register: result
29
-  retries: 5
30
-  delay: 1
31
-  until: result.msg is not defined or result.msg.find('configuration database locked by:') == -1

+ 8
- 2
etc/ansible/roles/openstack-ml2/providers/junos/update_access_port.yaml View File

@@ -1,3 +1,9 @@
1 1
 ---
2
-- name: "junos: run update access port using netconf"
3
-  include_tasks: netconf.yaml
2
+- name: "junos: run update access port using network_cli"
3
+  junos_command:
4
+    commands:
5
+      - config
6
+      - "set interfaces {{ ml2_port_name }} unit 0 family ethernet-switching interface-mode access"
7
+      - "set interfaces {{ ml2_port_name }} unit 0 family ethernet-switching vlan members {{ ml2_segmentation_id }}"
8
+      - commit
9
+  connection: network_cli

+ 0
- 10
etc/ansible/roles/openstack-ml2/templates/junos/create_vlan.xml.j2 View File

@@ -1,10 +0,0 @@
1
-<config>
2
-    <configuration>
3
-        <vlans>
4
-            <vlan>
5
-                <name>{{ ml2_segmentation_name }}</name>
6
-                <vlan-id>{{ ml2_segmentation_id }}</vlan-id>
7
-            </vlan>
8
-        </vlans>
9
-    </configuration>
10
-</config>

+ 0
- 12
etc/ansible/roles/openstack-ml2/templates/junos/delete_port.xml.j2 View File

@@ -1,12 +0,0 @@
1
-<config>
2
-    <configuration>
3
-        <interfaces>
4
-            <interface>
5
-                <name>{{ ml2_port_name }}</name>
6
-                <unit delete="delete">
7
-                    <name>0</name>
8
-                </unit>
9
-            </interface>
10
-        </interfaces>
11
-    </configuration>
12
-</config>

+ 0
- 9
etc/ansible/roles/openstack-ml2/templates/junos/delete_vlan.xml.j2 View File

@@ -1,9 +0,0 @@
1
-<config>
2
-    <configuration>
3
-        <vlans>
4
-            <vlan delete="delete">
5
-                <name>{{ ml2_segmentation_name }}</name>
6
-            </vlan>
7
-        </vlans>
8
-    </configuration>
9
-</config>

+ 0
- 21
etc/ansible/roles/openstack-ml2/templates/junos/update_access_port.xml.j2 View File

@@ -1,21 +0,0 @@
1
-<config>
2
-    <configuration>
3
-        <interfaces>
4
-            <interface>
5
-                <name>{{ ml2_port_name }}</name>
6
-                <unit>
7
-                    <name>0</name>
8
-                    <description>{{ ml2_port_description }}</description>
9
-                    <family>
10
-                        <ethernet-switching>
11
-                            <interface-mode>access</interface-mode>
12
-                            <vlan>
13
-                                <members>{{ ml2_segmentation_id }}</members>
14
-                            </vlan>
15
-                        </ethernet-switching>
16
-                    </family>
17
-                </unit>
18
-            </interface>
19
-        </interfaces>
20
-    </configuration>
21
-</config>

+ 0
- 10
etc/ansible/roles/openstack-ml2/vars/main.yml View File

@@ -1,14 +1,4 @@
1 1
 ---
2
-# vars file for openstack-ml2
3
-#
4
-
5
-# controls whether or not the role will check to see if netconf is enabled or
6
-# not.  When this value is True, the role will first connect to the device over
7
-# CLI and check if the neconf service is enabled.  If it is not, this will then
8
-# enable the netconf service.  When this value is False, the service check will
9
-# not be performed
10
-junos_enable_netconf: yes
11
-
12 2
 # vars required for managing ML2 networks
13 3
 segmentation_id: null
14 4
 segmentation_name: null

Loading…
Cancel
Save