{"action":"created","comment":{"url":"https://api.github.com/repos/RackHD/RackHD/pulls/comments/84447766","pull_request_review_id":5225609,"id":84447766,"diff_hunk":"@@ -0,0 +1,401 @@\n+'''\n+Copyright 2015, EMC, Inc.\n+\n+Author(s):\n+Harry Ling\n+\n+'''\n+\n+import os\n+import sys\n+import json\n+import time\n+import string\n+import random\n+import urllib\n+from datetime import *\n+import time\n+import subprocess\n+# set path to common libraries\n+sys.path.append(subprocess.check_output(\"git rev-parse --show-toplevel\", shell=True).rstrip(\"\\n\") + \"/test/fit_tests/common\")\n+import fit_common\n+import test_api_utils\n+\n+# Local methods\n+MON_NODES = fit_common.node_select()\n+MON_API_VERSION = 2.0\n+\n+#clear the test environment\n+def tear_down():\n+    str_taglist = get_tag_list()\n+    taglist = json.loads(str_taglist)\n+    for tagitem in taglist:\n+        tagname = tagitem['name']\n+        delete_response = delete_tag(tagname)\n+        if delete_response not in range(200,205):\n+            print \"Fail to clear up the tag-\"+ tagname\n+            return 1\n+    nodes_list = get_node_id_list()\n+    for node in nodes_list:\n+        tags = get_tag_list_on_node(node)\n+        tag_list = json.loads(tags)\n+        for tag in tag_list:\n+            print \"{} has tags: {}\".format(node,tag)\n+            response = delete_tag_in_node(node,tag)\n+            if response  not in range(200,205):\n+                print \"Fail to delete the tag:\" + tag\n+                return 2\n+    print \"clear the environment finished!\"\n+    return 0\n+\n+def get_node_list_by_sku(skuname):\n+    response = fit_common.rackhdapi(\"/api/{}/skus\".format(MON_API_VERSION))\n+    skus = json.loads(response['text'])\n+    idfound = []\n+    for sku in skus:\n+        if skuname == sku['name']:\n+            sku_id = sku['id']\n+    response = fit_common.rackhdapi('/api/{}/nodes'.format(MON_API_VERSION))\n+    nodes = json.loads(response['text'])\n+    for node in nodes:\n+        if MON_API_VERSION == 1.1:\n+            if node.has_key('sku') and node['sku'] == sku_id:\n+                idfound.append(node['id'])\n+        if MON_API_VERSION == 2.0:\n+            if node.has_key('sku') and node['sku'].split('/')[-1] == sku_id:\n+                idfound.append(node['id'])\n+    return idfound\n+    \n+def delete_tag(tag_name):\n+    url_name = urllib.quote(tag_name,\"\")\n+    mon_url = \"/api/{}/tags/{}\".format(MON_API_VERSION,url_name)\n+    response_tag = fit_common.rackhdapi(mon_url,action='delete')\n+    return response_tag[\"status\"]\n+\n+def create_tag(json_tag_content):\n+    mon_url = '/api/{}/tags'.format(MON_API_VERSION)\n+    response_create_tag = fit_common.rackhdapi(mon_url,action='post',payload=json_tag_content)\n+    return response_create_tag[\"status\"]\n+\n+def get_tag(tag_name):\n+    url_name = urllib.quote(tag_name,\"\")\n+    mon_url = '/api/{}/tags/{}'.format(MON_API_VERSION,url_name)\n+    response_tag = fit_common.rackhdapi(mon_url)\n+    return response_tag['text']\n+\n+def get_node_by_tag(tag_name):\n+    url_name = urllib.quote(tag_name,\"\")\n+    mon_url = '/api/{}/tags/{}/nodes'.format(MON_API_VERSION,url_name)\n+    response_tag = fit_common.rackhdapi(mon_url)\n+    if response_tag['status'] in range(200,205):\n+        return response_tag['text']\n+    else:\n+        return response_tag['status']\n+\n+def get_tag_list():\n+    mon_url = '/api/{}/tags'.format(MON_API_VERSION)\n+    response_tag = fit_common.rackhdapi(mon_url)\n+    return response_tag['text']\n+\n+def get_tag_list_on_node(nodeid):","path":"test/fit_tests/tests/rackhd20/test_rackhd20_api_tagmanagement.py","position":100,"original_position":100,"commit_id":"261cc4f1c2c71dbd367eab1fceca5bb48ea04cc6","original_commit_id":"261cc4f1c2c71dbd367eab1fceca5bb48ea04cc6","user":{"login":"anhou","id":14013330,"avatar_url":"https://avatars.githubusercontent.com/u/14013330?v=3","gravatar_id":"","url":"https://api.github.com/users/anhou","html_url":"https://github.com/anhou","followers_url":"https://api.github.com/users/anhou/followers","following_url":"https://api.github.com/users/anhou/following{/other_user}","gists_url":"https://api.github.com/users/anhou/gists{/gist_id}","starred_url":"https://api.github.com/users/anhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anhou/subscriptions","organizations_url":"https://api.github.com/users/anhou/orgs","repos_url":"https://api.github.com/users/anhou/repos","events_url":"https://api.github.com/users/anhou/events{/privacy}","received_events_url":"https://api.github.com/users/anhou/received_events","type":"User","site_admin":false},"body":"is there any plan to use swagger client pyton library?","created_at":"2016-10-21T09:33:14Z","updated_at":"2016-10-21T09:33:19Z","html_url":"https://github.com/RackHD/RackHD/pull/458#discussion_r84447766","pull_request_url":"https://api.github.com/repos/RackHD/RackHD/pulls/458","_links":{"self":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/comments/84447766"},"html":{"href":"https://github.com/RackHD/RackHD/pull/458#discussion_r84447766"},"pull_request":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/458"}}},"pull_request":{"url":"https://api.github.com/repos/RackHD/RackHD/pulls/458","id":89963512,"html_url":"https://github.com/RackHD/RackHD/pull/458","diff_url":"https://github.com/RackHD/RackHD/pull/458.diff","patch_url":"https://github.com/RackHD/RackHD/pull/458.patch","issue_url":"https://api.github.com/repos/RackHD/RackHD/issues/458","number":458,"state":"open","locked":false,"title":"node tag and label feature","user":{"login":"lhw4d4","id":13897119,"avatar_url":"https://avatars.githubusercontent.com/u/13897119?v=3","gravatar_id":"","url":"https://api.github.com/users/lhw4d4","html_url":"https://github.com/lhw4d4","followers_url":"https://api.github.com/users/lhw4d4/followers","following_url":"https://api.github.com/users/lhw4d4/following{/other_user}","gists_url":"https://api.github.com/users/lhw4d4/gists{/gist_id}","starred_url":"https://api.github.com/users/lhw4d4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lhw4d4/subscriptions","organizations_url":"https://api.github.com/users/lhw4d4/orgs","repos_url":"https://api.github.com/users/lhw4d4/repos","events_url":"https://api.github.com/users/lhw4d4/events{/privacy}","received_events_url":"https://api.github.com/users/lhw4d4/received_events","type":"User","site_admin":false},"body":"@yyscamper @hohene @gpaulos ","created_at":"2016-10-19T08:34:16Z","updated_at":"2016-10-21T09:33:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0e19e4d41866253412d0ad88101552aa3910b33","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/RackHD/RackHD/pulls/458/commits","review_comments_url":"https://api.github.com/repos/RackHD/RackHD/pulls/458/comments","review_comment_url":"https://api.github.com/repos/RackHD/RackHD/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RackHD/RackHD/issues/458/comments","statuses_url":"https://api.github.com/repos/RackHD/RackHD/statuses/261cc4f1c2c71dbd367eab1fceca5bb48ea04cc6","head":{"label":"lhw4d4:node_tags","ref":"node_tags","sha":"261cc4f1c2c71dbd367eab1fceca5bb48ea04cc6","user":{"login":"lhw4d4","id":13897119,"avatar_url":"https://avatars.githubusercontent.com/u/13897119?v=3","gravatar_id":"","url":"https://api.github.com/users/lhw4d4","html_url":"https://github.com/lhw4d4","followers_url":"https://api.github.com/users/lhw4d4/followers","following_url":"https://api.github.com/users/lhw4d4/following{/other_user}","gists_url":"https://api.github.com/users/lhw4d4/gists{/gist_id}","starred_url":"https://api.github.com/users/lhw4d4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lhw4d4/subscriptions","organizations_url":"https://api.github.com/users/lhw4d4/orgs","repos_url":"https://api.github.com/users/lhw4d4/repos","events_url":"https://api.github.com/users/lhw4d4/events{/privacy}","received_events_url":"https://api.github.com/users/lhw4d4/received_events","type":"User","site_admin":false},"repo":{"id":71330858,"name":"RackHD","full_name":"lhw4d4/RackHD","owner":{"login":"lhw4d4","id":13897119,"avatar_url":"https://avatars.githubusercontent.com/u/13897119?v=3","gravatar_id":"","url":"https://api.github.com/users/lhw4d4","html_url":"https://github.com/lhw4d4","followers_url":"https://api.github.com/users/lhw4d4/followers","following_url":"https://api.github.com/users/lhw4d4/following{/other_user}","gists_url":"https://api.github.com/users/lhw4d4/gists{/gist_id}","starred_url":"https://api.github.com/users/lhw4d4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lhw4d4/subscriptions","organizations_url":"https://api.github.com/users/lhw4d4/orgs","repos_url":"https://api.github.com/users/lhw4d4/repos","events_url":"https://api.github.com/users/lhw4d4/events{/privacy}","received_events_url":"https://api.github.com/users/lhw4d4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lhw4d4/RackHD","description":"RackHD™ provides hardware management and orchestration services","fork":true,"url":"https://api.github.com/repos/lhw4d4/RackHD","forks_url":"https://api.github.com/repos/lhw4d4/RackHD/forks","keys_url":"https://api.github.com/repos/lhw4d4/RackHD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lhw4d4/RackHD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lhw4d4/RackHD/teams","hooks_url":"https://api.github.com/repos/lhw4d4/RackHD/hooks","issue_events_url":"https://api.github.com/repos/lhw4d4/RackHD/issues/events{/number}","events_url":"https://api.github.com/repos/lhw4d4/RackHD/events","assignees_url":"https://api.github.com/repos/lhw4d4/RackHD/assignees{/user}","branches_url":"https://api.github.com/repos/lhw4d4/RackHD/branches{/branch}","tags_url":"https://api.github.com/repos/lhw4d4/RackHD/tags","blobs_url":"https://api.github.com/repos/lhw4d4/RackHD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lhw4d4/RackHD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lhw4d4/RackHD/git/refs{/sha}","trees_url":"https://api.github.com/repos/lhw4d4/RackHD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lhw4d4/RackHD/statuses/{sha}","languages_url":"https://api.github.com/repos/lhw4d4/RackHD/languages","stargazers_url":"https://api.github.com/repos/lhw4d4/RackHD/stargazers","contributors_url":"https://api.github.com/repos/lhw4d4/RackHD/contributors","subscribers_url":"https://api.github.com/repos/lhw4d4/RackHD/subscribers","subscription_url":"https://api.github.com/repos/lhw4d4/RackHD/subscription","commits_url":"https://api.github.com/repos/lhw4d4/RackHD/commits{/sha}","git_commits_url":"https://api.github.com/repos/lhw4d4/RackHD/git/commits{/sha}","comments_url":"https://api.github.com/repos/lhw4d4/RackHD/comments{/number}","issue_comment_url":"https://api.github.com/repos/lhw4d4/RackHD/issues/comments{/number}","contents_url":"https://api.github.com/repos/lhw4d4/RackHD/contents/{+path}","compare_url":"https://api.github.com/repos/lhw4d4/RackHD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lhw4d4/RackHD/merges","archive_url":"https://api.github.com/repos/lhw4d4/RackHD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lhw4d4/RackHD/downloads","issues_url":"https://api.github.com/repos/lhw4d4/RackHD/issues{/number}","pulls_url":"https://api.github.com/repos/lhw4d4/RackHD/pulls{/number}","milestones_url":"https://api.github.com/repos/lhw4d4/RackHD/milestones{/number}","notifications_url":"https://api.github.com/repos/lhw4d4/RackHD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lhw4d4/RackHD/labels{/name}","releases_url":"https://api.github.com/repos/lhw4d4/RackHD/releases{/id}","deployments_url":"https://api.github.com/repos/lhw4d4/RackHD/deployments","created_at":"2016-10-19T07:32:39Z","updated_at":"2016-10-19T07:32:40Z","pushed_at":"2016-10-19T08:30:47Z","git_url":"git://github.com/lhw4d4/RackHD.git","ssh_url":"git@github.com:lhw4d4/RackHD.git","clone_url":"https://github.com/lhw4d4/RackHD.git","svn_url":"https://github.com/lhw4d4/RackHD","homepage":" http://rackhd.readthedocs.io","size":2525,"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":"RackHD:master","ref":"master","sha":"9a0138789faa41ac8afefcbd39bdbc237e3da2f7","user":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"repo":{"id":45687347,"name":"RackHD","full_name":"RackHD/RackHD","owner":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RackHD/RackHD","description":"RackHD™ provides hardware management and orchestration services","fork":false,"url":"https://api.github.com/repos/RackHD/RackHD","forks_url":"https://api.github.com/repos/RackHD/RackHD/forks","keys_url":"https://api.github.com/repos/RackHD/RackHD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RackHD/RackHD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RackHD/RackHD/teams","hooks_url":"https://api.github.com/repos/RackHD/RackHD/hooks","issue_events_url":"https://api.github.com/repos/RackHD/RackHD/issues/events{/number}","events_url":"https://api.github.com/repos/RackHD/RackHD/events","assignees_url":"https://api.github.com/repos/RackHD/RackHD/assignees{/user}","branches_url":"https://api.github.com/repos/RackHD/RackHD/branches{/branch}","tags_url":"https://api.github.com/repos/RackHD/RackHD/tags","blobs_url":"https://api.github.com/repos/RackHD/RackHD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RackHD/RackHD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RackHD/RackHD/git/refs{/sha}","trees_url":"https://api.github.com/repos/RackHD/RackHD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RackHD/RackHD/statuses/{sha}","languages_url":"https://api.github.com/repos/RackHD/RackHD/languages","stargazers_url":"https://api.github.com/repos/RackHD/RackHD/stargazers","contributors_url":"https://api.github.com/repos/RackHD/RackHD/contributors","subscribers_url":"https://api.github.com/repos/RackHD/RackHD/subscribers","subscription_url":"https://api.github.com/repos/RackHD/RackHD/subscription","commits_url":"https://api.github.com/repos/RackHD/RackHD/commits{/sha}","git_commits_url":"https://api.github.com/repos/RackHD/RackHD/git/commits{/sha}","comments_url":"https://api.github.com/repos/RackHD/RackHD/comments{/number}","issue_comment_url":"https://api.github.com/repos/RackHD/RackHD/issues/comments{/number}","contents_url":"https://api.github.com/repos/RackHD/RackHD/contents/{+path}","compare_url":"https://api.github.com/repos/RackHD/RackHD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RackHD/RackHD/merges","archive_url":"https://api.github.com/repos/RackHD/RackHD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RackHD/RackHD/downloads","issues_url":"https://api.github.com/repos/RackHD/RackHD/issues{/number}","pulls_url":"https://api.github.com/repos/RackHD/RackHD/pulls{/number}","milestones_url":"https://api.github.com/repos/RackHD/RackHD/milestones{/number}","notifications_url":"https://api.github.com/repos/RackHD/RackHD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RackHD/RackHD/labels{/name}","releases_url":"https://api.github.com/repos/RackHD/RackHD/releases{/id}","deployments_url":"https://api.github.com/repos/RackHD/RackHD/deployments","created_at":"2015-11-06T14:42:16Z","updated_at":"2016-10-20T09:41:13Z","pushed_at":"2016-10-21T09:04:18Z","git_url":"git://github.com/RackHD/RackHD.git","ssh_url":"git@github.com:RackHD/RackHD.git","clone_url":"https://github.com/RackHD/RackHD.git","svn_url":"https://github.com/RackHD/RackHD","homepage":" http://rackhd.readthedocs.io","size":3022,"stargazers_count":170,"watchers_count":170,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":84,"forks":88,"open_issues":84,"watchers":170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/458"},"html":{"href":"https://github.com/RackHD/RackHD/pull/458"},"issue":{"href":"https://api.github.com/repos/RackHD/RackHD/issues/458"},"comments":{"href":"https://api.github.com/repos/RackHD/RackHD/issues/458/comments"},"review_comments":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/458/comments"},"review_comment":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RackHD/RackHD/pulls/458/commits"},"statuses":{"href":"https://api.github.com/repos/RackHD/RackHD/statuses/261cc4f1c2c71dbd367eab1fceca5bb48ea04cc6"}}}}
{"actor":{"display_login":"anhou"}}