{"action":"created","comment":{"url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments/48155248","id":48155248,"diff_hunk":"@@ -0,0 +1,102 @@\n+# NXAPI implementation of the Pim class\n+# Provides configuration of PIM and its various properties\n+# like ssm-range, etc\n+#\n+# Smitha Gopalan, November 2015\n+#\n+# Copyright (c) 2014-2015 Cisco and/or its affiliates.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#-------------------------------------------------------\n+# CLI: <afi> pim ssm-range <range>  (under different VRFs)\n+#-------------------------------------------------------\n+\n+require_relative 'node_util'\n+\n+module Cisco\n+  # node_utils class for Pim\n+  class Pim < NodeUtil\n+    attr_reader :vrf, :afi\n+\n+    # Constructor with vrf\n+    # ---------------------\n+    def initialize(afi, vrf='default', instantiate=true)\n+      fail ArgumentError unless vrf.is_a? String\n+      fail ArgumentError unless vrf.length > 0\n+      @vrf = vrf\n+      @afi = Pim.afi_cli(afi)\n+      if @vrf == 'default'\n+        @get_args = @set_args = { state: '', afi: @afi }\n+      else\n+        @get_args = @set_args = { state: '', vrf: @vrf, afi: @afi }\n+      end\n+      enable if instantiate\n+    end\n+\n+    # Set afi\n+    # --------\n+    def self.afi_cli(afi)\n+      # Add ipv6 support later\n+      fail ArgumentError, \"Argument afi must be 'ipv4'\" unless\n+        afi[/(ipv4)/]\n+      afi[/ipv4/] ? 'ip' : afi\n+    end\n+\n+    # set_args_keys_default\n+    # ----------------------\n+    def set_args_keys_default\n+      keys = { afi: @afi }\n+      keys[:vrf] = @vrf unless @vrf == 'default'\n+      @get_args = @set_args = keys\n+    end\n+\n+    # set_args_key\n+    # -------------\n+    def set_args_keys(hash={}) # rubocop:disable Style/AccessorMethodName\n+      set_args_keys_default\n+      @set_args = @get_args.merge!(hash) unless hash.empty?\n+    end\n+\n+    # Enable Feature pim\n+    # -------------------\n+    def enable","path":"lib/cisco_node_utils/pim.rb","position":72,"original_position":72,"commit_id":"0b3acd8d2323647d60bf39ab8edf29b9f983ca09","original_commit_id":"0b3acd8d2323647d60bf39ab8edf29b9f983ca09","user":{"login":"chrisvanheuveln","id":12087548,"avatar_url":"https://avatars.githubusercontent.com/u/12087548?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvanheuveln","html_url":"https://github.com/chrisvanheuveln","followers_url":"https://api.github.com/users/chrisvanheuveln/followers","following_url":"https://api.github.com/users/chrisvanheuveln/following{/other_user}","gists_url":"https://api.github.com/users/chrisvanheuveln/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvanheuveln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvanheuveln/subscriptions","organizations_url":"https://api.github.com/users/chrisvanheuveln/orgs","repos_url":"https://api.github.com/users/chrisvanheuveln/repos","events_url":"https://api.github.com/users/chrisvanheuveln/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvanheuveln/received_events","type":"User","site_admin":false},"body":"You'll want to access this from other class files so use self instead:\r\n\r\n`  def self.enable`","created_at":"2015-12-21T15:23:00Z","updated_at":"2015-12-21T15:23:00Z","html_url":"https://github.com/cisco/cisco-network-node-utils/pull/144#discussion_r48155248","pull_request_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144","_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments/48155248"},"html":{"href":"https://github.com/cisco/cisco-network-node-utils/pull/144#discussion_r48155248"},"pull_request":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144"}}},"pull_request":{"url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144","id":54160920,"html_url":"https://github.com/cisco/cisco-network-node-utils/pull/144","diff_url":"https://github.com/cisco/cisco-network-node-utils/pull/144.diff","patch_url":"https://github.com/cisco/cisco-network-node-utils/pull/144.patch","issue_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/144","number":144,"state":"open","locked":false,"title":"Cisco Node Utils implementation for Pim","user":{"login":"smigopal","id":15915977,"avatar_url":"https://avatars.githubusercontent.com/u/15915977?v=3","gravatar_id":"","url":"https://api.github.com/users/smigopal","html_url":"https://github.com/smigopal","followers_url":"https://api.github.com/users/smigopal/followers","following_url":"https://api.github.com/users/smigopal/following{/other_user}","gists_url":"https://api.github.com/users/smigopal/gists{/gist_id}","starred_url":"https://api.github.com/users/smigopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smigopal/subscriptions","organizations_url":"https://api.github.com/users/smigopal/orgs","repos_url":"https://api.github.com/users/smigopal/repos","events_url":"https://api.github.com/users/smigopal/events{/privacy}","received_events_url":"https://api.github.com/users/smigopal/received_events","type":"User","site_admin":false},"body":"Pim:\r\n\r\nDescription: This is the node utils API for all Pim related properties.\r\nCLI: ip pim ssm-range (under different VRFs)\r\nFiles Associated: pim.yaml, pim.rb, test_pim.rb\r\n\r\nMiniTests:\r\n--------------\r\nrtpfe1@agent-lab11-ws:~/smigopal/pimbranch/cisco-network-node-utils$ ruby tests/test_pim.rb -v -- 10.122.197.125 admin admin\r\nRun options: -v -- --seed 34679\r\n\r\n# Running:\r\n\r\n\r\nNode under test:\r\n  - name  - agent-lab11-nx\r\n  - type  - N9K-NXOSV\r\n  - image - bootflash:///nxos.7.0.3.I2.1.bin\r\n\r\nTestPim#test_multiple_ssm_range_overwrite_multiple_vrfs = 3.55 s = .\r\nTestPim#test_multiple_ssm_range_multiple_vrfs = 2.06 s = .\r\nTestPim#test_single_ssm_range_none_single_vrf = 1.85 s = .\r\nTestPim#test_single_invalid_ssm_range_single_vrf = 1.31 s = .\r\nTestPim#test_single_ssm_range_single_vrf = 1.74 s = .\r\n\r\nFinished in 10.518501s, 0.4754 runs/s, 0.8556 assertions/s.\r\n\r\n5 runs, 9 assertions, 0 failures, 0 errors, 0 skips\r\nCoverage report generated for MiniTest to /home/rtpfe1/smigopal/pimbranch/cisco-network-node-utils/coverage. 373 / 486 LOC (76.75%) covered.\r\n\r\nRubocop:\r\n------------\r\nrtpfe1@agent-lab11-ws:~/smigopal/pimbranch/cisco-network-node-utils$ rubocop tests/test_pim.rb\r\nwarning: parser/current is loading parser/ruby22, which recognizes\r\nwarning: 2.2.3-compliant syntax, but you are running 2.2.1.\r\nwarning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.\r\nInspecting 1 file\r\n.\r\n\r\n1 file inspected, no offenses detected\r\nrtpfe1@agent-lab11-ws:~/smigopal/pimbranch/cisco-network-node-utils$ rubocop lib/cisco_node_utils/pim.rb\r\nwarning: parser/current is loading parser/ruby22, which recognizes\r\nwarning: 2.2.3-compliant syntax, but you are running 2.2.1.\r\nwarning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.\r\nInspecting 1 file\r\n.\r\n\r\n1 file inspected, no offenses detected\r\nrtpfe1@agent-lab11-ws:~/smigopal/pimbranch/cisco-network-node-utils$\r\n\r\n","created_at":"2015-12-18T23:16:45Z","updated_at":"2015-12-21T15:23:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144/commits","review_comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144/comments","review_comment_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/144/comments","statuses_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/0b3acd8d2323647d60bf39ab8edf29b9f983ca09","head":{"label":"smigopal:PIM","ref":"PIM","sha":"0b3acd8d2323647d60bf39ab8edf29b9f983ca09","user":{"login":"smigopal","id":15915977,"avatar_url":"https://avatars.githubusercontent.com/u/15915977?v=3","gravatar_id":"","url":"https://api.github.com/users/smigopal","html_url":"https://github.com/smigopal","followers_url":"https://api.github.com/users/smigopal/followers","following_url":"https://api.github.com/users/smigopal/following{/other_user}","gists_url":"https://api.github.com/users/smigopal/gists{/gist_id}","starred_url":"https://api.github.com/users/smigopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smigopal/subscriptions","organizations_url":"https://api.github.com/users/smigopal/orgs","repos_url":"https://api.github.com/users/smigopal/repos","events_url":"https://api.github.com/users/smigopal/events{/privacy}","received_events_url":"https://api.github.com/users/smigopal/received_events","type":"User","site_admin":false},"repo":{"id":46452863,"name":"cisco-network-node-utils","full_name":"smigopal/cisco-network-node-utils","owner":{"login":"smigopal","id":15915977,"avatar_url":"https://avatars.githubusercontent.com/u/15915977?v=3","gravatar_id":"","url":"https://api.github.com/users/smigopal","html_url":"https://github.com/smigopal","followers_url":"https://api.github.com/users/smigopal/followers","following_url":"https://api.github.com/users/smigopal/following{/other_user}","gists_url":"https://api.github.com/users/smigopal/gists{/gist_id}","starred_url":"https://api.github.com/users/smigopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smigopal/subscriptions","organizations_url":"https://api.github.com/users/smigopal/orgs","repos_url":"https://api.github.com/users/smigopal/repos","events_url":"https://api.github.com/users/smigopal/events{/privacy}","received_events_url":"https://api.github.com/users/smigopal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smigopal/cisco-network-node-utils","description":"","fork":true,"url":"https://api.github.com/repos/smigopal/cisco-network-node-utils","forks_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/forks","keys_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/teams","hooks_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/hooks","issue_events_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/issues/events{/number}","events_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/events","assignees_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/assignees{/user}","branches_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/branches{/branch}","tags_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/tags","blobs_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/languages","stargazers_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/stargazers","contributors_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/contributors","subscribers_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/subscribers","subscription_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/subscription","commits_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/contents/{+path}","compare_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/merges","archive_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/downloads","issues_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/issues{/number}","pulls_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/labels{/name}","releases_url":"https://api.github.com/repos/smigopal/cisco-network-node-utils/releases{/id}","created_at":"2015-11-18T22:53:56Z","updated_at":"2015-11-18T22:53:57Z","pushed_at":"2015-12-18T23:08:25Z","git_url":"git://github.com/smigopal/cisco-network-node-utils.git","ssh_url":"git@github.com:smigopal/cisco-network-node-utils.git","clone_url":"https://github.com/smigopal/cisco-network-node-utils.git","svn_url":"https://github.com/smigopal/cisco-network-node-utils","homepage":null,"size":1329,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"cisco:develop","ref":"develop","sha":"4f52138c0e82f84131d048b75698753d9537208e","user":{"login":"cisco","id":1376999,"avatar_url":"https://avatars.githubusercontent.com/u/1376999?v=3","gravatar_id":"","url":"https://api.github.com/users/cisco","html_url":"https://github.com/cisco","followers_url":"https://api.github.com/users/cisco/followers","following_url":"https://api.github.com/users/cisco/following{/other_user}","gists_url":"https://api.github.com/users/cisco/gists{/gist_id}","starred_url":"https://api.github.com/users/cisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cisco/subscriptions","organizations_url":"https://api.github.com/users/cisco/orgs","repos_url":"https://api.github.com/users/cisco/repos","events_url":"https://api.github.com/users/cisco/events{/privacy}","received_events_url":"https://api.github.com/users/cisco/received_events","type":"Organization","site_admin":false},"repo":{"id":39565196,"name":"cisco-network-node-utils","full_name":"cisco/cisco-network-node-utils","owner":{"login":"cisco","id":1376999,"avatar_url":"https://avatars.githubusercontent.com/u/1376999?v=3","gravatar_id":"","url":"https://api.github.com/users/cisco","html_url":"https://github.com/cisco","followers_url":"https://api.github.com/users/cisco/followers","following_url":"https://api.github.com/users/cisco/following{/other_user}","gists_url":"https://api.github.com/users/cisco/gists{/gist_id}","starred_url":"https://api.github.com/users/cisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cisco/subscriptions","organizations_url":"https://api.github.com/users/cisco/orgs","repos_url":"https://api.github.com/users/cisco/repos","events_url":"https://api.github.com/users/cisco/events{/privacy}","received_events_url":"https://api.github.com/users/cisco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cisco/cisco-network-node-utils","description":"","fork":false,"url":"https://api.github.com/repos/cisco/cisco-network-node-utils","forks_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/forks","keys_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/teams","hooks_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/hooks","issue_events_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/events{/number}","events_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/events","assignees_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/assignees{/user}","branches_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/branches{/branch}","tags_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/tags","blobs_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/languages","stargazers_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/stargazers","contributors_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/contributors","subscribers_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/subscribers","subscription_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/subscription","commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/contents/{+path}","compare_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/merges","archive_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/downloads","issues_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues{/number}","pulls_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/labels{/name}","releases_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/releases{/id}","created_at":"2015-07-23T12:07:39Z","updated_at":"2015-12-17T07:37:55Z","pushed_at":"2015-12-20T16:55:16Z","git_url":"git://github.com/cisco/cisco-network-node-utils.git","ssh_url":"git@github.com:cisco/cisco-network-node-utils.git","clone_url":"https://github.com/cisco/cisco-network-node-utils.git","svn_url":"https://github.com/cisco/cisco-network-node-utils","homepage":null,"size":2773,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":4,"forks":31,"open_issues":4,"watchers":7,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144"},"html":{"href":"https://github.com/cisco/cisco-network-node-utils/pull/144"},"issue":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/144"},"comments":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/0b3acd8d2323647d60bf39ab8edf29b9f983ca09"}}}}