cvprac 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2377a7f1bb4ef6337d0a69922d25c03954250e6a
4
+ data.tar.gz: 7efa3b3ee60c9a5291a27eaf39dbb3270b2b6d40
5
+ SHA512:
6
+ metadata.gz: 801b0867d2a90f6632beee05aa9d3b7e73b6f01f59f22e9ddbe7c4abd402d9f20976162047f600dfa4b956e84cb7656c1ca3fa1f80e3f3040c09e3f3ecd7cc10
7
+ data.tar.gz: 573406286b72125c63c4eb26aa4c8c259023f929613068376e8e9dde815d3c21e97e549959dbe0b5a599ef7a0736f3ec65fdbe5ec6bd098b3264b62c1680098a
@@ -0,0 +1,51 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /results/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ ## Specific to RubyMotion:
18
+ .dat*
19
+ .repl_history
20
+ build/
21
+ *.bridgesupport
22
+ build-iPhoneOS/
23
+ build-iPhoneSimulator/
24
+
25
+ ## Specific to RubyMotion (use of CocoaPods):
26
+ #
27
+ # We recommend against adding the Pods directory to your .gitignore. However
28
+ # you should judge for yourself, the pros and cons are mentioned at:
29
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
+ #
31
+ # vendor/Pods/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalization:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ Gemfile.lock
47
+ .ruby-version
48
+ .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ #--drb
4
+ --format Fuubar
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'spec/fixtures'
4
+
5
+ Metrics/BlockLength:
6
+ Max: 140
7
+ Exclude:
8
+ - spec/unit/*
@@ -0,0 +1,24 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-12-16 10:54:59 -0500 using RuboCop version 0.46.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments.
11
+ Metrics/BlockLength:
12
+ Max: 31
13
+
14
+ # Offense count: 2
15
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
+ # URISchemes: http, https
17
+ Metrics/LineLength:
18
+ Max: 85
19
+
20
+ # Offense count: 2
21
+ # Cop supports --auto-correct.
22
+ Style/UnneededPercentQ:
23
+ Exclude:
24
+ - 'cvprac.gemspec'
@@ -0,0 +1,26 @@
1
+ # Change Log
2
+
3
+ ## [1.0.0](https://github.com/aristanetworks/cvprac-rb/tree/1.0.0) (2017-08-08)
4
+ **Implemented enhancements:**
5
+
6
+ - API: Manage configlet content [\#5](https://github.com/aristanetworks/cvprac-rb/issues/5)
7
+ - API: Execute tasks and return status [\#3](https://github.com/aristanetworks/cvprac-rb/issues/3)
8
+ - API: Assign configlet to node or container [\#2](https://github.com/aristanetworks/cvprac-rb/issues/2)
9
+ - Jenkins archive gem file on master and develop branches [\#11](https://github.com/aristanetworks/cvprac-rb/pull/11) ([jerearista](https://github.com/jerearista))
10
+ - Feature api [\#10](https://github.com/aristanetworks/cvprac-rb/pull/10) ([jerearista](https://github.com/jerearista))
11
+ - Update style and update Jenkinsfile to declarative syntax [\#9](https://github.com/aristanetworks/cvprac-rb/pull/9) ([jerearista](https://github.com/jerearista))
12
+ - Feature api [\#8](https://github.com/aristanetworks/cvprac-rb/pull/8) ([jerearista](https://github.com/jerearista))
13
+ - Initial API class with methods to manage basic configlet content [\#6](https://github.com/aristanetworks/cvprac-rb/pull/6) ([jerearista](https://github.com/jerearista))
14
+
15
+ **Closed issues:**
16
+
17
+ - Base API class [\#7](https://github.com/aristanetworks/cvprac-rb/issues/7)
18
+ - System Test with latest CloudVision Portal [\#4](https://github.com/aristanetworks/cvprac-rb/issues/4)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Initial function [\#1](https://github.com/aristanetworks/cvprac-rb/pull/1) ([jerearista](https://github.com/jerearista))
23
+
24
+
25
+
26
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jere@arista.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,36 @@
1
+ # Contributing Guidelines
2
+
3
+ Please ensure all pull requests include appropriate Yard docstrings and Rspec
4
+ tests.
5
+
6
+ After checking out the repo, run `bin/setup` to install
7
+ dependencies and setup git hooks. Then, run `bundle exec rake
8
+ checks` to run the tests. You can also run `bin/console` for an
9
+ interactive prompt that will allow you to experiment.
10
+
11
+ # Environment setup
12
+
13
+ To install this gem onto your local machine, run `bundle exec rake install`. or
14
+ to setup your environment for development, run `bundle install --path
15
+ .bundle/gems`
16
+
17
+ # Releases
18
+
19
+ To release a new version, run:
20
+
21
+ `bundle exec rake checks`
22
+ `bundle exec rake bump:[major|minor|patch|pre]`
23
+ `bundle exec rake changelog`
24
+ `bundle exec rake release`
25
+
26
+ This will create a git tag, push git commits and tags and push the .gem file to
27
+ [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on
32
+ [GitHub](https://github.com/arista-aristanetworks/cvprac-rb).
33
+
34
+ This project is intended to be a safe, welcoming space for collaboration, and
35
+ contributors are expected to adhere to the [Contributor
36
+ Covenant](http://contributor-covenant.org) code of conduct.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in cvprac.gemspec
6
+ gemspec
@@ -0,0 +1,11 @@
1
+ guard 'rspec' do
2
+ # watch /lib/ files
3
+ watch(%r{^lib/(.+).rb$}) do |m|
4
+ "spec/#{m[1]}_spec.rb"
5
+ end
6
+
7
+ # watch /spec/ files
8
+ watch(%r{^spec/(.+).rb$}) do |m|
9
+ "spec/#{m[1]}.rb"
10
+ end
11
+ end
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env groovy
2
+
3
+ /**
4
+ * Declarative Jenkinsfile for cvprac rubygem
5
+ *
6
+ * See RVM setup instructions for nodes
7
+ * https://rvm.io/integration/jenkins
8
+ */
9
+ pipeline {
10
+ agent { label 'puppet' }
11
+ options {
12
+ buildDiscarder(
13
+ // Only keep the 10 most recent builds
14
+ logRotator(numToKeepStr:'10'))
15
+ }
16
+ environment {
17
+ projectName = 'cvprac rubygem'
18
+ emailTo = 'eosplus-dev+jenkins@arista.com'
19
+ emailFrom = 'eosplus-dev+jenkins@arista.com'
20
+ }
21
+ stages {
22
+ stage ('Setup Env') {
23
+ steps {
24
+ sh """
25
+ #!/bin/bash -l
26
+ set +x
27
+ [[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
28
+ /usr/local/rvm/bin/rvm list
29
+ rvm use 2.3.3@cvprac-rb --create
30
+ gem install bundler --no-ri --no-rdoc
31
+ set -x
32
+ which ruby
33
+ ruby --version
34
+ bin/setup
35
+ """
36
+ }
37
+ }
38
+
39
+ stage ('Check_style') {
40
+
41
+ steps {
42
+ sh """
43
+ #!/bin/bash -l
44
+ set +x
45
+ source /usr/local/rvm/scripts/rvm
46
+ rvm use 2.3.3@cvprac-rb
47
+ set -x
48
+ bundle exec rake rubocop || true
49
+ """
50
+ }
51
+ }
52
+
53
+ stage ('RSpec Unittests') {
54
+ steps {
55
+ sh """
56
+ #!/bin/bash -l
57
+ set +x
58
+ source /usr/local/rvm/scripts/rvm
59
+ rvm use 2.3.3@cvprac-rb
60
+ set -x
61
+ bundle exec rake ci_spec || true
62
+ """
63
+
64
+ step([$class: 'JUnitResultArchiver', testResults: 'results/*.xml'])
65
+ }
66
+ }
67
+
68
+ stage ('YARD doc generation') {
69
+ steps {
70
+ sh """
71
+ #!/bin/bash -l
72
+ set +x
73
+ source /usr/local/rvm/scripts/rvm
74
+ rvm use 2.3.3@cvprac-rb
75
+ set -x
76
+ bundle exec rake yard || true
77
+ """
78
+ }
79
+ }
80
+
81
+ stage ('Deploy system testbed') {
82
+ steps {
83
+ /*
84
+ when {
85
+ expression {
86
+ GIT_BRANCH = 'origin/' + sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
87
+ // return !(GIT_BRANCH == 'origin/master' || params.FORCE_FULL_BUILD)
88
+ // }
89
+ // branch { 'master' }
90
+ // sh "ping -c 10 10.81.111.62"
91
+ // }
92
+ */
93
+ script {
94
+ def setupResult = build job: 'Build_CVP_Testbed', parameters: [
95
+ string(name: 'FQDN_NAME', value: 'cvpracrb-cvp.rtp.aristanetworks.com'),
96
+ string(name: 'VSPHERE_FOLDER', value: 'cvprac-ruby'),
97
+ string(name: 'CVP_VERSION', value: '2017.1.0.1'),
98
+ string(name: 'CVP_ADDRESSES', value: "10.81.111.62"),
99
+ string(name: 'VEOS_VERSION', value: '4.16.6M-ztp'),
100
+ string(name: 'TOPOLOGY', value: 'flat'),
101
+ booleanParam(name: 'BUILD_TESTS', value: false),
102
+ booleanParam(name: 'TEARDOWN', value: false)
103
+ ]
104
+ def systest_build_number = setupResult.getNumber()
105
+ // Navigate to jenkins > Manage jenkins > In-process Script Approval
106
+ // staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods putAt java.lang.Object java.lang.String java.lang.Object
107
+ env['setup_build_number'] = setupResult.getNumber()
108
+ }
109
+ }
110
+ }
111
+
112
+ stage ('System tests') {
113
+ steps {
114
+ sh """
115
+ #!/bin/bash -l
116
+ set +x
117
+ source /usr/local/rvm/scripts/rvm
118
+ rvm use 2.3.3@cvprac-rb
119
+ set -x
120
+ bundle exec rake spec:system || true
121
+ """
122
+
123
+ step([$class: 'JUnitResultArchiver', testResults: 'results/*.xml'])
124
+ }
125
+ }
126
+
127
+ stage ('Destroy system testbed') {
128
+ steps {
129
+ echo "ENV-setup_build_number: ${env.setup_build_number}"
130
+ /*
131
+ when {
132
+ expression {
133
+ PING_RES = sh(returnStdout: true, script: "ping -c 10 10.81.111.62").trim()
134
+ return PING_RES == 100
135
+ }
136
+ }
137
+ */
138
+ build job: 'Destroy_CVP_Testbed', parameters: [
139
+ string(name: 'BUILD_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.38.1'> <buildNumber>${env.setup_build_number}</buildNumber></SpecificBuildSelector>")
140
+ ]
141
+ // echo sh(returnStdout: true, script: 'env')
142
+ }
143
+ }
144
+
145
+ stage ('Archive artifacts') {
146
+ when {
147
+ anyOf { branch 'master'; branch 'develop' }
148
+ }
149
+ steps {
150
+ sh """
151
+ #!/bin/bash -l
152
+ set +x
153
+ source /usr/local/rvm/scripts/rvm
154
+ rvm use 2.3.3@cvprac-rb
155
+ set -x
156
+ bundle exec rake build
157
+ """
158
+ archiveArtifacts artifacts: 'pkg/*.gemm', fingerprint: true, onlyIfSuccessful: true
159
+ }
160
+ }
161
+
162
+ stage ('Cleanup') {
163
+
164
+ steps {
165
+
166
+ step([$class: 'WarningsPublisher',
167
+ canComputeNew: false,
168
+ canResolveRelativePaths: false,
169
+ consoleParsers: [
170
+ [parserName: 'Rubocop'],
171
+ [parserName: 'Rspec']
172
+ ],
173
+ defaultEncoding: '',
174
+ excludePattern: '',
175
+ healthy: '',
176
+ includePattern: '',
177
+ unHealthy: ''
178
+ ])
179
+
180
+ step([
181
+ $class: 'RcovPublisher',
182
+ reportDir: "coverage/rcov",
183
+ targets: [
184
+ [metric: "CODE_COVERAGE", healthy: 90, unhealthy: 80, unstable: 50]
185
+ ]
186
+ ])
187
+
188
+ // publish html
189
+ // snippet generator doesn't include "target:"
190
+ // https://issues.jenkins-ci.org/browse/JENKINS-29711.
191
+ publishHTML (target: [
192
+ allowMissing: false,
193
+ alwaysLinkToLastBuild: false,
194
+ keepAll: true,
195
+ reportDir: 'coverage',
196
+ reportFiles: 'index.html',
197
+ reportName: "RCov Report"
198
+ ])
199
+ publishHTML (target: [
200
+ allowMissing: false,
201
+ alwaysLinkToLastBuild: false,
202
+ keepAll: true,
203
+ reportDir: 'doc',
204
+ reportFiles: 'index.html',
205
+ reportName: "YARD Docs"
206
+ ])
207
+ }
208
+ }
209
+ }
210
+
211
+ post {
212
+ always {
213
+ echo sh(returnStdout: true, script: 'env')
214
+ mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build ${currentBuild.result}\n" +
215
+ "Started by ${env.BUILD_CAUSE}\n" +
216
+ "Run status: ${env.RUN_DISPLAY_URL}\n" +
217
+ "Project status: ${env.JOB_DISPLAY_URL}\n" +
218
+ "Changes in this build: ${env.RUN_CHANGES_DISPLAY_URL}\n" +
219
+ "Built on node: ${env.NODE_NAME}\n",
220
+ from: env.emailFrom,
221
+ //replyTo: env.emailFrom,
222
+ subject: "${env.projectName} ${env.JOB_NAME} (${env.BUILD_NUMBER}) build ${currentBuild.result}",
223
+ to: env.emailTo
224
+ }
225
+ success {
226
+ echo sh(returnStdout: true, script: 'env')
227
+ mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build success\n" +
228
+ "Started by ${env.BUILD_CAUSE}\n" +
229
+ "Run status: ${env.RUN_DISPLAY_URL}\n" +
230
+ "Project status: ${env.JOB_DISPLAY_URL}\n" +
231
+ "Changes in this build: ${env.RUN_CHANGES_DISPLAY_URL}\n" +
232
+ "Built on node: ${env.NODE_NAME}\n",
233
+ from: env.emailFrom,
234
+ //replyTo: env.emailFrom,
235
+ subject: "${env.projectName} ${env.JOB_NAME} (${env.BUILD_NUMBER}) build succeeded",
236
+ to: env.emailTo
237
+ }
238
+ }
239
+ }