Juniper / puppet-netdev-stdlib-junos

Junos specific Provider code for "netdev_stdlib". Netdev is a vendor-neutral network abstraction framework developed by Juniper Networks and contributed freely to the DevOps community.
Apache License 2.0
25 stars 14 forks source link

Error is not handled properly #9

Open Jainpriyal opened 9 years ago

Jainpriyal commented 9 years ago

When creating XE interface, speed is not a valid parameter. But when giving speed as a parameter in puppet manifest file

netdev_interface { "xe-0/1/0":
ensure => present,
active => true,
admin => up,
description => "interface-xe-0/1/0 is created and modified by puppet",
speed =>1g,
duplex => full
 }

Its not giving any error or warning while running puppet, and creating interface without speed.

% puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
ldapname is deprecated and will be removed in a future version
Info: Caching catalog for router
Info: Applying configuration version '1416302365'
Notice: /Stage[main]/Main/Netdev_l2_interface[xe-0/1/0]/ensure: created
Notice: /Stage[main]/Main/Netdev_interface[xe-0/1/0]/description: description changed '' to 'interface-xe-0/1/0 is created and modified by puppet'
Notice: /Stage[main]/Main/Netdev_interface[xe-0/1/0]/speed: speed changed 'auto' to '1g'
Info: JUNOS: Committing 2 changes.
Notice: JUNOS: 

[edit interfaces]
+   xe-0/1/0 {
+       description "interface-xe-0/1/0 is created and modified by puppet";
+       unit 0 {
+           description "l2-interface xe-0/1/0 is created by puppet in trunk mode";
+           family ethernet-switching {
+               interface-mode trunk;
+               vlan {
+                   members Green;
+               }
+           }
+       }
+   }

Notice: JUNOS: OK: COMMIT success!
Notice: Finished catalog run in 9.62 seconds
% cli
sh{master:0}
puppet@router> show configuration interfaces xe-0/1/0 
description "interface-xe-0/1/0 is created and modified by puppet";
unit 0 {
    description "l2-interface xe-0/1/0 is created by puppet in trunk mode";
    family ethernet-switching {
        interface-mode trunk;
        vlan {
            members Green;
        }
    }
}

It should give some kind of warning or error if using wrong parameter.