Exemplo n.º 1
0
    def setUp(self):
        '''
        Copy all files related to testing to device
        @fn set_up
        @param self
        '''
        # Get iotivity-node version
        get_version(self)

        # Download the repository of soletta
        sys.stdout.write('\nDownloading the repository of iotivity-node...')
        sys.stdout.flush()
        iotivity_url = ''.join([
            'https://github.com/otcshare/iotivity-node/archive/',
            self.branch_version,
            '.zip'
            ])
        get_test_module_repo(iotivity_url, 'iotivity-node')

        sys.stdout.write('\nCopying necessary node modules to target device...')
        sys.stdout.flush()

        oldscp = self.target.connection.scp[:]
        self.target.connection.scp.insert(1, '-r')
        # Copy all modules related to testing to device
        copy_node_modules(self)

        # Copy all files related to testing to device
        copy_test_files(self)
        sys.stdout.write(
            '\nCopy all files related to testing to target device done!'
            )
        sys.stdout.flush()

        self.target.connection.scp[:] = oldscp
    def setUp(self):
        '''
        Copy all files related to testing to device
        @fn set_up
        @param self
        '''
        # Get iotivity-node version
        self.target.copy_to(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'iotivity_node_get_version_package_file.py'),
            '/usr/lib/node_modules/iotivity-node/')
        get_version(self)

        # Download the repository of soletta
        sys.stdout.write('\nDownloading the repository of iotivity-node...')
        sys.stdout.flush()

        # Get the iotivity-node archive dynamically based on the version of target device.
        iotivity_url = ''.join([
            'https://github.com/otcshare/iotivity-node/archive/',
            '%s.zip' % self.branch_version
        ])
        get_test_module_repo(iotivity_url, 'iotivity-node')

        sys.stdout.write(
            '\nCopying necessary node modules to target device...')
        sys.stdout.flush()

        oldscp = self.target.connection.scp[:]
        self.target.connection.scp.insert(1, '-r')
        # Copy all modules related to testing to device
        copy_node_modules(self)

        # Copy all files related to testing to device
        update_suite_js()
        copy_test_files(self)
        sys.stdout.write(
            '\nCopy all files related to testing to target device done!')
        sys.stdout.flush()

        self.target.connection.scp[:] = oldscp

        # Set firewall rules
        (status, output
         ) = self.target.run("cat /proc/sys/net/ipv4/ip_local_port_range")
        port_range = output.split()
        self.target.run(
            "/usr/sbin/iptables -w -A INPUT -p udp --dport 5683 -j ACCEPT")
        self.target.run(
            "/usr/sbin/iptables -w -A INPUT -p udp --dport 5684 -j ACCEPT")
        self.target.run(
            "/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport 5683 -j ACCEPT"
        )
        self.target.run(
            "/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport 5684 -j ACCEPT"
        )
        self.target.run(
            "/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport %s:%s -j ACCEPT"
            % (port_range[0], port_range[1]))
Exemplo n.º 3
0
    def setUp(self):
        '''
        Copy all files related to testing to device
        @fn set_up
        @param self
        '''
        # Get iotivity-node version
        self.target.copy_to(
            os.path.join(
                os.path.dirname(os.path.realpath(__file__)),
                'iotivity_node_get_version_package_file.py'),
            '/usr/lib/node_modules/iotivity-node/'
            )
        get_version(self)

        # Download the repository of soletta
        sys.stdout.write('\nDownloading the repository of iotivity-node...')
        sys.stdout.flush()

        # Get the iotivity-node archive dynamically based on the version of target device.
        iotivity_url = ''.join([
            'https://github.com/otcshare/iotivity-node/archive/',
            '%s.zip' % self.branch_version
            ])
        get_test_module_repo(iotivity_url, 'iotivity-node')

        sys.stdout.write('\nCopying necessary node modules to target device...')
        sys.stdout.flush()

        oldscp = self.target.connection.scp[:]
        self.target.connection.scp.insert(1, '-r')
        # Copy all modules related to testing to device
        copy_node_modules(self)

        # Copy all files related to testing to device
        update_suite_js()
        copy_test_files(self)
        sys.stdout.write(
            '\nCopy all files related to testing to target device done!'
            )
        sys.stdout.flush()

        self.target.connection.scp[:] = oldscp

        # Set firewall rules
        (status, output) = self.target.run("cat /proc/sys/net/ipv4/ip_local_port_range")
        port_range = output.split()
        self.target.run("/usr/sbin/iptables -w -A INPUT -p udp --dport 5683 -j ACCEPT")
        self.target.run("/usr/sbin/iptables -w -A INPUT -p udp --dport 5684 -j ACCEPT")
        self.target.run("/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport 5683 -j ACCEPT")
        self.target.run("/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport 5684 -j ACCEPT")
        self.target.run("/usr/sbin/ip6tables -w -A INPUT -s fe80::/10 -p udp -m udp --dport %s:%s -j ACCEPT" % (port_range[0], port_range[1]))
Exemplo n.º 4
0
    def setUp(self):
        '''
        Copy all files related to testing to device
        @fn set_up
        @param self
        '''
        # Get iotivity-node version
        self.target.copy_to(
            os.path.join(
                os.path.dirname(os.path.realpath(__file__)),
                'iotivity_node_get_version_package_file.py'),
            '/usr/lib/node_modules/iotivity-node/'
            )
        get_version(self)

        # Download the repository of soletta
        sys.stdout.write('\nDownloading the repository of iotivity-node...')
        sys.stdout.flush()
        iotivity_url = ''.join([
            'https://github.com/otcshare/iotivity-node/archive/',
            #self.branch_version,
            '1.1.1-0.zip'
            ])
        get_test_module_repo(iotivity_url, 'iotivity-node')

        sys.stdout.write('\nCopying necessary node modules to target device...')
        sys.stdout.flush()

        oldscp = self.target.connection.scp[:]
        self.target.connection.scp.insert(1, '-r')
        # Copy all modules related to testing to device
        copy_node_modules(self)

        # Copy all files related to testing to device
        update_suite_js()
        copy_test_files(self)
        sys.stdout.write(
            '\nCopy all files related to testing to target device done!'
            )
        sys.stdout.flush()

        self.target.connection.scp[:] = oldscp