Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWE-2449 upgrade junos gem #4

Open
wants to merge 51 commits into
base: fix-diff+no-rake
Choose a base branch
from

Conversation

hwnjng
Copy link

@hwnjng hwnjng commented Jul 9, 2019

Rebased our fork's master with original. Then rebased this branch with master.

Jainpriyal and others added 30 commits June 26, 2015 15:21
Adding support for l2_interface
'netdev_group' resource support.
solving duplicate declaration, issue Juniper#27
solving rerunning lag_interface
modified addition of tagged vlans
Ganesh Nalawade and others added 21 commits March 11, 2016 12:17
fix below warning from github
```
We found a potential security vulnerability in one of your dependencies.
A dependency defined in ./junos-ez-stdlib.gemspec has known security vulnerabilities and should be updated.
```
Fix diff? method for newer JunOS versions
…sions

of QFX, REs are named as LOCALRE. This code patch accommodates this deviation
in naming convention and returns the version number of LOCALRE.
@hwnjng hwnjng requested a review from a team July 9, 2019 21:12
@jordan0day
Copy link
Member

So, I did some initial testing on this change last night to see how/if it affected narwhal, and I am seeing some interesting behavior we'll probably want to try to hunt down.

You'll want to update your narwhal's gemfile to point to this branch:
gem 'junos-ez-stdlib', git: 'https://github.com/packethost/ruby-junos-ez-stdlib.git', branch: 'SWE-2449-upgrade-junos-gem'
and run a bundle install.

Then, with your local (or dockerized) narwhal up and running (and the lab CSR enrolled), you can run a script like:

#!/usr/bin/env bash

SWITCH='csr1.lab1.packet.net'
PORT1='xe-0/0/65:0'
PORT2='xe-1/0/65:0'

HOST='http://localhost:9090'
UUID='test'
SECRET_KEY='test'
CONTENT_TYPE='application/json'
DATE=$(TZ=GMT date "+%a, %d %b %Y %T %Z")

METHOD="POST"
URI="/devices/$SWITCH/ports"

# { "interface": "xe-0/0/17" }

RESPONSE=$(curl -sS --request "$METHOD" --url "$HOST$URI" -H "Content-Type: $CONTENT_TYPE" -H "Authorization: APIAuth $UUID:$(echo -n "$METHOD,$CONTENT_TYPE,,$URI,$DATE" | openssl dgst -sha1 -binary -hmac $SECRET_KEY "$@" | base64)" -H "Date: $DATE" -d @- <<EOF
{	"interfaces": [ { "interface": "$PORT1" }, { "interface": "$PORT2" } ],
	"addresses": [ { "address": "10.1.1.1/24" } ],
	"description": "Some port name"
}
EOF
)

echo $RESPONSE | jq

Actually, maybe run the script once on an unmodified narwhal, and then change your Gemfile and re-run it, so you can compare before-and-after. Regardless, when I run the script above on an unmodified narwhal, everything works a-ok. When I run it on a narwhal updated to use the new branch, I get a nasty-looking error (though the commit does seem to succeed, still?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants