{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments/63344940","id":63344940,"diff_hunk":"@@ -0,0 +1,168 @@\n+#!/bin/python\n+import aexpect\n+from distutils.spawn import find_executable\n+from autotest.client import test, utils\n+from autotest.client.shared import error\n+\n+\n+class libndp(test.test):\n+\n+    \"\"\"\n+    libndp -Library for Neighbor Discovery Protocol\n+\n+    Neighbor Discovery Protocol (NDP) is a part of the Internet Protocol suite used with IPv6.\n+    NDP Protocol make use of ICMPv6 messages and solicited-node multicast addresses for operating    its core function, which is tracking and discovering other IPv6 hosts that are present on the    other side of connected interfaces.\n+\n+    libndp package contains a library,libndp.so :which provides a wrapper for IPv6 Neighbor         Discovery Protocol and ndptool :tool for sending and receiving NDP messages.\n+\n+    @author Ramya BS <ramya@linux.vnet.ibm.com>\n+\n+    \"\"\"\n+    version = 2\n+    nfail = 0\n+    interface = utils.subprocess.Popen(\n+        [\"ip\", \"-6\", \"route\", \"show\", \"default\"], stdout=utils.subprocess.PIPE)\n+    interface_out = interface.stdout.read()\n+    get_active_interface = utils.re.search(\n+        \"default via\\s+\\S+\\s+dev\\s+(\\w+)\\s+proto\", interface_out)\n+    iface = get_active_interface.group(1)\n+    get_ipv6_addr = utils.subprocess.Popen(\n+        [\"ip\", \"addr\", \"show\", \"dev\", \"eth0\"], stdout=utils.subprocess.PIPE)\n+    get_ipv6_addr_out = get_ipv6_addr.stdout.read()\n+    ipv6_addr = utils.re.search(\n+        \"inet6\\s+(fe80.*)\\s+scope\",\n+        get_ipv6_addr_out).group(1).strip(\"/64\")\n+    ns = \"Type: NS\"\n+    rs = \"Type: RA\"\n+\n+    def install_check(self):\n+        \"\"\"\n+        install check for libndp library and ndptool binary\n+        check for ip ,route ,tcpdump\n+        \"\"\"\n+\n+        if self.iface is None:\n+            raise error.TestError('\\n ipv6 is not configured on this system')\n+        lib_files = utils.glob.glob('/usr/lib*/libndp.so*')\n+        if not lib_files:\n+            raise error.TestError(\n+                '\\n No paths matching pathname pattern found:Failed to find libndp.so library')\n+        else:\n+            for file in lib_files:\n+                if not utils.os.path.exists(file):\n+                    raise error.TestError(\n+                        '\\nInstall check for library libndp.so failed')\n+        ndptool_exe = find_executable('ndptool')\n+        if ndptool_exe is None:\n+            raise error.TestError('\\n ndptool not found')\n+        route_exe = find_executable('route')\n+        if route_exe is None:\n+            raise error.TestError('\\n route not found')\n+        tcpdump_exe = find_executable('tcpdump')\n+        if tcpdump_exe is None:\n+            raise error.TestError('\\n tcpdump not found')\n+        ip_exe = find_executable('ip')\n+        if ip_exe is None:\n+            raise error.TestError('\\n ip not found')\n+\n+    def monitor_ndp_messages(self):\n+        \"\"\"\n+        Monitors incoming NDP messages on specified interface i.e iface using \"ndptool\"\n+        and verifies it using tcpdump output .\n+        \"\"\"\n+        tcpdump = aexpect.Spawn(\"tcpdump -n -i %s icmp6\" % self.iface)\n+        monitor_ndp = aexpect.Spawn(\"ndptool monitor -i %s\" % self.iface)\n+        utils.os.system(\"ndptool send -t ns -i %s\" % self.iface)\n+        utils.os.system(\"ndptool send -t rs -i %s\" % self.iface)\n+        utils.time.sleep(5)\n+        tcpdump_output = tcpdump.get_output()\n+        tcpdump.close()\n+        monitor_ndp_output = monitor_ndp.get_output()\n+        monitor_ndp.close()\n+        if self.ipv6_addr not in tcpdump_output and monitor_ndp_output:\n+            self.nfail += 1\n+            raise error.TestError(\n+                '\\n ndptool failed to monitor NDP messages')\n+        else:\n+            utils.logging.info(\n+                '\\n ndptool successfully  monitored NDP messages')","path":"linux-tools/libndp/libndp.py","position":88,"original_position":88,"commit_id":"18404a071d180f2bf21021fb1a172b870c6a7eda","original_commit_id":"18404a071d180f2bf21021fb1a172b870c6a7eda","user":{"login":"will-Do","id":1916899,"avatar_url":"https://avatars.githubusercontent.com/u/1916899?v=3","gravatar_id":"","url":"https://api.github.com/users/will-Do","html_url":"https://github.com/will-Do","followers_url":"https://api.github.com/users/will-Do/followers","following_url":"https://api.github.com/users/will-Do/following{/other_user}","gists_url":"https://api.github.com/users/will-Do/gists{/gist_id}","starred_url":"https://api.github.com/users/will-Do/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/will-Do/subscriptions","organizations_url":"https://api.github.com/users/will-Do/orgs","repos_url":"https://api.github.com/users/will-Do/repos","events_url":"https://api.github.com/users/will-Do/events{/privacy}","received_events_url":"https://api.github.com/users/will-Do/received_events","type":"User","site_admin":false},"body":"redundant spaces","created_at":"2016-05-16T12:21:25Z","updated_at":"2016-05-16T12:21:25Z","html_url":"https://github.com/autotest/autotest-client-tests/pull/64#discussion_r63344940","pull_request_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments/63344940"},"html":{"href":"https://github.com/autotest/autotest-client-tests/pull/64#discussion_r63344940"},"pull_request":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64","id":66459131,"html_url":"https://github.com/autotest/autotest-client-tests/pull/64","diff_url":"https://github.com/autotest/autotest-client-tests/pull/64.diff","patch_url":"https://github.com/autotest/autotest-client-tests/pull/64.patch","issue_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/64","number":64,"state":"open","locked":false,"title":"Testcase for  libndp","user":{"login":"ramyabs","id":16132621,"avatar_url":"https://avatars.githubusercontent.com/u/16132621?v=3","gravatar_id":"","url":"https://api.github.com/users/ramyabs","html_url":"https://github.com/ramyabs","followers_url":"https://api.github.com/users/ramyabs/followers","following_url":"https://api.github.com/users/ramyabs/following{/other_user}","gists_url":"https://api.github.com/users/ramyabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ramyabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramyabs/subscriptions","organizations_url":"https://api.github.com/users/ramyabs/orgs","repos_url":"https://api.github.com/users/ramyabs/repos","events_url":"https://api.github.com/users/ramyabs/events{/privacy}","received_events_url":"https://api.github.com/users/ramyabs/received_events","type":"User","site_admin":false},"body":"libndp -Library for Neighbor Discovery Protocol\r\nNeighbor Discovery Protocol (NDP) is a part of the Internet Protocol suite used with IPv6.\r\nNDP Protocol make use of ICMPv6 messages and solicited-node multicast addresses for operating its core function, which is tracking and discovering other IPv6 hosts that are present on the other side of connected interfaces. Another use of NDP is address autoconfiguration.\r\n\r\nSigned-off-by : Ramya BS <ramya@linux.vnet.ibm.com>\r\nTested-by     : Ramya BS <ramya@linux.vnet.ibm.com>","created_at":"2016-04-14T10:11:08Z","updated_at":"2016-05-16T12:21:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8a8368f2cdfd267c9eceec539200fe400535062","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64/commits","review_comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64/comments","review_comment_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/64/comments","statuses_url":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/18404a071d180f2bf21021fb1a172b870c6a7eda","head":{"label":"ramyabs:libndp_test","ref":"libndp_test","sha":"18404a071d180f2bf21021fb1a172b870c6a7eda","user":{"login":"ramyabs","id":16132621,"avatar_url":"https://avatars.githubusercontent.com/u/16132621?v=3","gravatar_id":"","url":"https://api.github.com/users/ramyabs","html_url":"https://github.com/ramyabs","followers_url":"https://api.github.com/users/ramyabs/followers","following_url":"https://api.github.com/users/ramyabs/following{/other_user}","gists_url":"https://api.github.com/users/ramyabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ramyabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramyabs/subscriptions","organizations_url":"https://api.github.com/users/ramyabs/orgs","repos_url":"https://api.github.com/users/ramyabs/repos","events_url":"https://api.github.com/users/ramyabs/events{/privacy}","received_events_url":"https://api.github.com/users/ramyabs/received_events","type":"User","site_admin":false},"repo":{"id":50088756,"name":"autotest-client-tests","full_name":"ramyabs/autotest-client-tests","owner":{"login":"ramyabs","id":16132621,"avatar_url":"https://avatars.githubusercontent.com/u/16132621?v=3","gravatar_id":"","url":"https://api.github.com/users/ramyabs","html_url":"https://github.com/ramyabs","followers_url":"https://api.github.com/users/ramyabs/followers","following_url":"https://api.github.com/users/ramyabs/following{/other_user}","gists_url":"https://api.github.com/users/ramyabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ramyabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramyabs/subscriptions","organizations_url":"https://api.github.com/users/ramyabs/orgs","repos_url":"https://api.github.com/users/ramyabs/repos","events_url":"https://api.github.com/users/ramyabs/events{/privacy}","received_events_url":"https://api.github.com/users/ramyabs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ramyabs/autotest-client-tests","description":"Autotest client tests","fork":true,"url":"https://api.github.com/repos/ramyabs/autotest-client-tests","forks_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/forks","keys_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/teams","hooks_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/hooks","issue_events_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/issues/events{/number}","events_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/events","assignees_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/assignees{/user}","branches_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/branches{/branch}","tags_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/tags","blobs_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/languages","stargazers_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/stargazers","contributors_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/contributors","subscribers_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/subscribers","subscription_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/subscription","commits_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/contents/{+path}","compare_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/merges","archive_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/downloads","issues_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/issues{/number}","pulls_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/labels{/name}","releases_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/releases{/id}","deployments_url":"https://api.github.com/repos/ramyabs/autotest-client-tests/deployments","created_at":"2016-01-21T07:02:26Z","updated_at":"2016-01-21T07:02:27Z","pushed_at":"2016-04-14T10:07:49Z","git_url":"git://github.com/ramyabs/autotest-client-tests.git","ssh_url":"git@github.com:ramyabs/autotest-client-tests.git","clone_url":"https://github.com/ramyabs/autotest-client-tests.git","svn_url":"https://github.com/ramyabs/autotest-client-tests","homepage":null,"size":72660,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"master"}},"base":{"label":"autotest:master","ref":"master","sha":"04a3b5597ab14aa629d756a748bf5e737024faac","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"repo":{"id":5952007,"name":"autotest-client-tests","full_name":"autotest/autotest-client-tests","owner":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autotest/autotest-client-tests","description":"Autotest client tests","fork":false,"url":"https://api.github.com/repos/autotest/autotest-client-tests","forks_url":"https://api.github.com/repos/autotest/autotest-client-tests/forks","keys_url":"https://api.github.com/repos/autotest/autotest-client-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/autotest-client-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/autotest-client-tests/teams","hooks_url":"https://api.github.com/repos/autotest/autotest-client-tests/hooks","issue_events_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/autotest-client-tests/events","assignees_url":"https://api.github.com/repos/autotest/autotest-client-tests/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/autotest-client-tests/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/tags","blobs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/autotest-client-tests/languages","stargazers_url":"https://api.github.com/repos/autotest/autotest-client-tests/stargazers","contributors_url":"https://api.github.com/repos/autotest/autotest-client-tests/contributors","subscribers_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscribers","subscription_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscription","commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/autotest-client-tests/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/autotest-client-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/autotest-client-tests/merges","archive_url":"https://api.github.com/repos/autotest/autotest-client-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/autotest-client-tests/downloads","issues_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/autotest-client-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/autotest-client-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/autotest-client-tests/labels{/name}","releases_url":"https://api.github.com/repos/autotest/autotest-client-tests/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/autotest-client-tests/deployments","created_at":"2012-09-25T15:21:39Z","updated_at":"2016-05-08T17:35:50Z","pushed_at":"2016-05-08T17:35:09Z","git_url":"git://github.com/autotest/autotest-client-tests.git","ssh_url":"git@github.com:autotest/autotest-client-tests.git","clone_url":"https://github.com/autotest/autotest-client-tests.git","svn_url":"https://github.com/autotest/autotest-client-tests","homepage":null,"size":101823,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":6,"forks":53,"open_issues":6,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64"},"html":{"href":"https://github.com/autotest/autotest-client-tests/pull/64"},"issue":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/issues/64"},"comments":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/18404a071d180f2bf21021fb1a172b870c6a7eda"}}}}