Commit 90be042f authored by Amit Karamchandani Batra's avatar Amit Karamchandani Batra
Browse files

Merge branch 'feat/l3-components' of https://labs.etsi.org/rep/tfs/controller...

Merge branch 'feat/l3-components' of https://labs.etsi.org/rep/tfs/controller into feat/l3-components
parents 8e04db4e 768960f6
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -146,9 +146,9 @@ class l3_distributedattackdetector:
        # Log a message indicating that the program is stopping gracefully
        # Log a message indicating that the program is stopping gracefully
        LOGGER.info("Gracefully stopping...")
        LOGGER.info("Gracefully stopping...")


    def follow(self, file, time_sleep):
    def follow(self, logfile, time_sleep):
        """
        """
        Generator function that yields new lines in a file.
        Generator function that yields new lines in a log file.


        This method reads a file object and yields new lines as they are added to the file. The method uses an infinite loop to continuously read the last line of the file. If the file hasn't been updated, the method sleeps for the specified `time_sleep` interval. If the last line of the file doesn't end with a newline character, the method appends the line to a `chunk` variable. When a newline character is encountered, the method yields the line, possibly appending the `chunk` variable to the line if it contains a partial line. The method returns an iterator that yields lines from the file.
        This method reads a file object and yields new lines as they are added to the file. The method uses an infinite loop to continuously read the last line of the file. If the file hasn't been updated, the method sleeps for the specified `time_sleep` interval. If the last line of the file doesn't end with a newline character, the method appends the line to a `chunk` variable. When a newline character is encountered, the method yields the line, possibly appending the `chunk` variable to the line if it contains a partial line. The method returns an iterator that yields lines from the file.


@@ -164,14 +164,14 @@ class l3_distributedattackdetector:
        """
        """


        # seek the end of the file
        # seek the end of the file
        # file.seek(0, os.SEEK_END)
        # logfile.seek(0, os.SEEK_END)


        chunk = ""
        chunk = ""


        # start an infinite loop
        # start an infinite loop
        while True:
        while True:
            # read last line of the file
            # read last line of the file
            line = file.readline()
            line = logfile.readline()


            # sleep if the file hasn't been updated
            # sleep if the file hasn't been updated
            if not line:
            if not line:
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
# limitations under the License.
# limitations under the License.


source src/tests/scenario3/l3/deploy_specs.sh
source src/tests/scenario3/l3/deploy_specs.sh
deploy/all.sh
./deploy/all.sh
source tfs_runtime_env_vars.sh
source tfs_runtime_env_vars.sh
ofc22/run_test_01_bootstrap.sh
ofc22/run_test_01_bootstrap.sh
ofc22/run_test_02_create_service.sh
ofc22/run_test_02_create_service.sh