Signed-off-by: Viliam Luc <vluc@cisco.com>
Change-Id: I4d8de4e6ccff25c0c1dcf66c192c56710939bf7d
import sys
from bcc import BPF
import sys
from bcc import BPF
+from .constants import Constants
sample_period=duration
)
except AttributeError:
sample_period=duration
)
except AttributeError:
- getLogger(__name__).error(u"Cannot attach BPF events!")
- sys.exit(1)
+ getLogger("console_stderr").error(u"Could not attach BPF events!")
+ sys.exit(Constants.err_linux_attach)
ev_config=event[u"name"]
)
except AttributeError:
ev_config=event[u"name"]
)
except AttributeError:
- getLogger(__name__).error(u"Cannot dettach BPF events!")
- sys.exit(1)
+ getLogger("console_stderr").error(u"Could not detach BPF events!")
+ sys.exit(Constants.err_linux_detach)
def fetch_data(self):
"""
def fetch_data(self):
"""
# Failed when processing data
err_telemetry_process = 1
# Failed when processing data
err_telemetry_process = 1
+ # Failed to read YAML file
+ err_telemetry_yaml = 2
+
+ # Error executing bundle
+ err_telemetry_bundle = 3
+
# Could not connect to VPP
err_vpp_connect = 11
# Could not connect to VPP
err_vpp_connect = 11
# Failed when executing command
err_vpp_execute = 13
# Failed when executing command
err_vpp_execute = 13
+ # Could not attach BPF events
+ err_linux_attach = 51
+
+ # Could not detach BPF events
+ err_linux_detach = 52
+
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
from .parser import Parser
from .serializer import Serializer
from .parser import Parser
from .serializer import Serializer
+from .constants import Constants
"""
super().__init__()
self.message = message
"""
super().__init__()
self.message = message
- getLogger(__name__).error(message)
- sys.exit(1)
+ getLogger("console_stderr").error(message)
+ sys.exit(Constants.err_telemetry_bundle)
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
import sys
from yaml import safe_load, YAMLError
import sys
from yaml import safe_load, YAMLError
+from .constants import Constants
"""
super().__init__()
self.message = message
"""
super().__init__()
self.message = message
- getLogger(__name__).error(self.message)
- sys.exit(1)
+ getLogger("console_stderr").error(self.message)
+ sys.exit(Constants.err_telemetry_yaml)