# Path: credentials.py
# VMWARE_VCENTER_USERNAME = "domain\\username"
# VMWARE_VCENTER_PASSWORD = "yourpassword"
# SNMP_COMMUNITY = "public"
# TINTRI_USER = "youraccount"
# TINTRI_PASSWORD = "yourpassword"
# WORKDESK_USER = 'youraccount'
# WORKDESK_PASSWORD = 'yourpassword'
# RUBRIK_USER = 'youraccount'
# RUBRIK_PASSWORD = 'yourpassword'
# NUTANIX_USER = 'youraccount'
# NUTANIX_PASSWORD = 'yourpassword'
# 
# Path: credentials.py
# VMWARE_VCENTER_USERNAME = "domain\\username"
# VMWARE_VCENTER_PASSWORD = "yourpassword"
# SNMP_COMMUNITY = "public"
# TINTRI_USER = "youraccount"
# TINTRI_PASSWORD = "yourpassword"
# WORKDESK_USER = 'youraccount'
# WORKDESK_PASSWORD = 'yourpassword'
# RUBRIK_USER = 'youraccount'
# RUBRIK_PASSWORD = 'yourpassword'
# NUTANIX_USER = 'youraccount'
# NUTANIX_PASSWORD = 'yourpassword'


from mechanize import Browser
from credentials import VNX_REPORTER_USERNAME   # Login info now stored in credentials.py
from credentials import VNX_REPORTER_PASSWORD   # Login info now stored in credentials.py
        from mechanize._form import SubmitControl, ScalarControl
import mechanize
import csv
import StringIO
import time
import json
import operator
                    self.disabled = False
                    self.value = ""
                    self.disabled = True
                else:
                    self.value = ""
            self.readonly = True

        SubmitControl.__init__ = __init__


# Mechanize cannot read forms when the submit button is disabled (as happens on this page).  To work around this
# issue, we apply the patch listed above.
monkeypatch_mechanize()


def generate_json(vnx_monitor):
    """This function will connect to the VNX web server, parse data and store the output in vnx_monitor.json"""
    try:
        # Create Mechanize browser
        browser = Browser()

        # Open the main VNX-Reporter login page and login
        browser.open(VNX_REPORTER_WEBSERVER)

        # Note that the login form doesn't have a name, but we locate it by ID
        for form in browser.forms():
            if form.attrs['id'] == 'login-form':
                browser.form = form
                break


# Path: credentials.py
# VMWARE_VCENTER_USERNAME = "domain\\username"
# VMWARE_VCENTER_PASSWORD = "yourpassword"
# SNMP_COMMUNITY = "public"
# TINTRI_USER = "youraccount"
# TINTRI_PASSWORD = "yourpassword"
# WORKDESK_USER = 'youraccount'
# WORKDESK_PASSWORD = 'yourpassword'
# RUBRIK_USER = 'youraccount'
# RUBRIK_PASSWORD = 'yourpassword'
# NUTANIX_USER = 'youraccount'
# NUTANIX_PASSWORD = 'yourpassword'
# 
# Path: credentials.py
# VMWARE_VCENTER_USERNAME = "domain\\username"
# VMWARE_VCENTER_PASSWORD = "yourpassword"
# SNMP_COMMUNITY = "public"
# TINTRI_USER = "youraccount"
# TINTRI_PASSWORD = "yourpassword"
# WORKDESK_USER = 'youraccount'
# WORKDESK_PASSWORD = 'yourpassword'
# RUBRIK_USER = 'youraccount'
# RUBRIK_PASSWORD = 'yourpassword'
# NUTANIX_USER = 'youraccount'
# NUTANIX_PASSWORD = 'yourpassword'


# Path: retired modules/vnx_reporter.py
from mechanize import Browser
from credentials import VNX_REPORTER_USERNAME   # Login info now stored in credentials.py
from credentials import VNX_REPORTER_PASSWORD   # Login info now stored in credentials.py
        from mechanize._form import SubmitControl, ScalarControl
import mechanize
import csv
import StringIO
import time
import json
import operator

                    self.disabled = False
                    self.value = ""
                    self.disabled = True
                else:
                    self.value = ""
            self.readonly = True

        SubmitControl.__init__ = __init__


# Mechanize cannot read forms when the submit button is disabled (as happens on this page).  To work around this
# issue, we apply the patch listed above.
monkeypatch_mechanize()


def generate_json(vnx_monitor):
    """This function will connect to the VNX web server, parse data and store the output in vnx_monitor.json"""
    try:
        # Create Mechanize browser
        browser = Browser()

        # Open the main VNX-Reporter login page and login
        browser.open(VNX_REPORTER_WEBSERVER)

        # Note that the login form doesn't have a name, but we locate it by ID
        for form in browser.forms():
            if form.attrs['id'] == 'login-form':
                browser.form = form
                break


        browser["j_username"] = VNX_REPORTER_USERNAME